Skip to content

Commit

Permalink
Merge branch 'main' of github.com:PTsolvers/Chmy.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
luraess committed Mar 4, 2024
2 parents c9e52ad + a5b9a88 commit c6eafd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
11 changes: 11 additions & 0 deletions test/test_fields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ using Chmy.Architectures
using Chmy.Fields
using Chmy.Grids

using LinearAlgebra

for backend in backends
@testset "$(basename(@__FILE__)) (backend: $backend)" begin
# test setup
Expand Down Expand Up @@ -51,21 +53,30 @@ for backend in backends
0.0; 0.0;; 1.0; 1.0;; 2.0; 2.0]
end
end
# @testset "linalg" begin
# f = Field(backend, grid, Center())
# set!(f, 1.0)
# @test norm(f, 1) ≈ 8
# @test norm(f, 2) ≈ norm(f) ≈ sqrt(8)
# end
@testset "constant field" begin
@testset "zero" begin
field = ZeroField{Float64}()
@test field[1, 1, 1] 0.0
@test field[2, 2, 2] 0.0
@test size(field) == ()
end
@testset "one" begin
field = OneField{Float64}()
@test field[1, 1, 1] 1.0
@test field[2, 2, 2] 1.0
@test size(field) == ()
end
@testset "const" begin
field = ValueField(2.0)
@test field[1, 1, 1] 2.0
@test field[2, 2, 2] 2.0
@test size(field) == ()
end
end
end
Expand Down

0 comments on commit c6eafd4

Please sign in to comment.