Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/stencil_set_test.jl @ 1854:654a2b7e6824 tooling/benchmarks
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 11 Jan 2025 10:19:47 +0100 |
parents | 471a948cd2b2 |
children |
comparison
equal
deleted
inserted
replaced
1378:2b5480e2d4bf | 1854:654a2b7e6824 |
---|---|
1 using Test | 1 using Test |
2 | 2 |
3 using TOML | 3 using TOML |
4 using Sbplib.SbpOperators | 4 using Diffinitive.SbpOperators |
5 | 5 |
6 import Sbplib.SbpOperators.Stencil | 6 import Diffinitive.SbpOperators.Stencil |
7 import Diffinitive.SbpOperators.NestedStencil | |
7 | 8 |
8 @testset "readoperator" begin | 9 @testset "readoperator" begin |
9 toml_str = """ | 10 toml_str = """ |
10 [meta] | 11 [meta] |
11 authors = "Ken Mattson" | 12 authors = "Ken Mattson" |
168 @test SbpOperators.parse_rational("0.5") == 1//2 | 169 @test SbpOperators.parse_rational("0.5") == 1//2 |
169 | 170 |
170 @test SbpOperators.parse_rational(2) isa Rational | 171 @test SbpOperators.parse_rational(2) isa Rational |
171 @test SbpOperators.parse_rational(2) == 2//1 | 172 @test SbpOperators.parse_rational(2) == 2//1 |
172 end | 173 end |
174 | |
175 @testset "parse_nested_stencil" begin | |
176 toml = TOML.parse(""" | |
177 s1 = [["1/2", "1/2", "0"],[ "-1/2", "-1", "-1/2"],["0", "1/2", "1/2"]] | |
178 s2 = {s = [[ "2", "-1", "0"],[ "-3", "1", "0"],["1", "0", "0"]], c = 1} | |
179 s3 = {s = [[ "2", "-1", "0"],[ "-3", "1", "0"],["1", "0", "0"]], c = 2} | |
180 """) | |
181 | |
182 @test parse_nested_stencil(toml["s1"]) == CenteredNestedStencil((1//2, 1//2, 0//1),( -1//2, -1//1, -1//2),(0//1, 1//2, 1//2)) | |
183 @test parse_nested_stencil(toml["s2"]) == NestedStencil((2//1, -1//1, 0//1),( -3//1, 1//1, 0//1),(1//1, 0//1, 0//1), center = 1) | |
184 @test parse_nested_stencil(toml["s3"]) == NestedStencil((2//1, -1//1, 0//1),( -3//1, 1//1, 0//1),(1//1, 0//1, 0//1), center = 2) | |
185 | |
186 @test parse_nested_stencil(Float64, toml["s1"]) == CenteredNestedStencil((1/2, 1/2, 0.),( -1/2, -1., -1/2),(0., 1/2, 1/2)) | |
187 @test parse_nested_stencil(Int, toml["s2"]) == NestedStencil((2, -1, 0),( -3, 1, 0),(1, 0, 0), center = 1) | |
188 end |