Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/stencil_test.jl @ 1061:d1ddcdc098bf feature/nested_stencils
Add promotion functionality for NestedTuples
(grafted from cd6d71781137b29d5a9a16b7162051163e4314a4)
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 13 Feb 2022 21:40:23 +0100 |
parents | ff0e819f2075 |
children | a7f898b1ce1e |
comparison
equal
deleted
inserted
replaced
1060:ff0e819f2075 | 1061:d1ddcdc098bf |
---|---|
85 | 85 |
86 @test convert(NestedStencil{Float64}, ns) == NestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.), center=2) | 86 @test convert(NestedStencil{Float64}, ns) == NestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.), center=2) |
87 @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) | 87 @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) |
88 end | 88 end |
89 | 89 |
90 @testset "promotion of weights" begin | |
91 @test NestedStencil((-1,1,0),(-1.,0.,1.),(0,-1,1), center=2) isa NestedStencil{Float64,3,3} | |
92 @test NestedStencil((-1,1,0),(-1,0,1),(0//1,-1,1), center=2) isa NestedStencil{Rational{Int64},3,3} | |
93 end | |
94 | |
95 @testset "promotion" begin | |
96 promote( | |
97 CenteredNestedStencil((-1,1,0),(-1,0,1),(0,-1,1)), | |
98 CenteredNestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.)) | |
99 ) == ( | |
100 CenteredNestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.)), | |
101 CenteredNestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.)) | |
102 ) | |
103 end | |
104 | |
90 @testset "apply" begin | 105 @testset "apply" begin |
91 c = [ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55] | 106 c = [ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55] |
92 v = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29] | 107 v = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29] |
93 | 108 |
94 # Centered | 109 # Centered |