comparison test/SbpOperators/stencil_test.jl @ 1063:f98893154e22 feature/nested_stencils

Fix type instability for stencil application when weights and vector didn't match (grafted from a7f898b1ce1ea3adfe21201d3ccafdffb09c5be6)
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Feb 2022 14:28:48 +0100
parents d1ddcdc098bf
children 47f5451cdfc4
comparison
equal deleted inserted replaced
1062:a76830879c63 1063:f98893154e22
40 @test Stencil(1,2//2; center = 1) isa Stencil{Rational{Int64}, 2} 40 @test Stencil(1,2//2; center = 1) isa Stencil{Rational{Int64}, 2}
41 end 41 end
42 42
43 @testset "promotion" begin 43 @testset "promotion" begin
44 @test promote(Stencil(1,1;center=1), Stencil(2.,2.;center=2)) == (Stencil(1.,1.;center=1), Stencil(2.,2.;center=2)) 44 @test promote(Stencil(1,1;center=1), Stencil(2.,2.;center=2)) == (Stencil(1.,1.;center=1), Stencil(2.,2.;center=2))
45 end
46
47 @testset "type inference" begin
48 s_int = CenteredStencil(1,2,3)
49 s_float = CenteredStencil(1.,2.,3.)
50 v_int = rand(1:10,10);
51 v_float = rand(10);
52
53 @inferred SbpOperators.apply_stencil(s_int, v_int, 2)
54 @inferred SbpOperators.apply_stencil(s_float, v_float, 2)
55 @inferred SbpOperators.apply_stencil(s_int, v_float, 2)
56 @inferred SbpOperators.apply_stencil(s_float, v_int, 2)
45 end 57 end
46 end 58 end
47 59
48 @testset "NestedStencil" begin 60 @testset "NestedStencil" begin
49 61