Mercurial > repos > public > sbplib_julia
diff test/SbpOperators/stencil_test.jl @ 898:cd6d71781137 feature/variable_derivatives
Add promotion functionality for NestedTuples
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 13 Feb 2022 21:40:23 +0100 |
parents | 737cd68318c7 |
children | a7f898b1ce1e |
line wrap: on
line diff
--- a/test/SbpOperators/stencil_test.jl Sat Feb 12 22:02:06 2022 +0100 +++ b/test/SbpOperators/stencil_test.jl Sun Feb 13 21:40:23 2022 +0100 @@ -87,6 +87,21 @@ @test convert(NestedStencil{Rational}, ns) == NestedStencil((-1//1,1//1,0//1),(-1//1,0//1,1//1),(0//1,-1//1,1//1), center=2) end + @testset "promotion of weights" begin + @test NestedStencil((-1,1,0),(-1.,0.,1.),(0,-1,1), center=2) isa NestedStencil{Float64,3,3} + @test NestedStencil((-1,1,0),(-1,0,1),(0//1,-1,1), center=2) isa NestedStencil{Rational{Int64},3,3} + end + + @testset "promotion" begin + promote( + CenteredNestedStencil((-1,1,0),(-1,0,1),(0,-1,1)), + CenteredNestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.)) + ) == ( + CenteredNestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.)), + CenteredNestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.)) + ) + end + @testset "apply" begin c = [ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55] v = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]