diff test/SbpOperators/stencil_test.jl @ 903:a7f898b1ce1e feature/variable_derivatives

Fix type instability for stencil application when weights and vector didn't match
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Feb 2022 14:28:48 +0100
parents cd6d71781137
children 47f5451cdfc4
line wrap: on
line diff
--- a/test/SbpOperators/stencil_test.jl	Mon Feb 14 12:00:45 2022 +0100
+++ b/test/SbpOperators/stencil_test.jl	Mon Feb 14 14:28:48 2022 +0100
@@ -43,6 +43,18 @@
     @testset "promotion" begin
         @test promote(Stencil(1,1;center=1), Stencil(2.,2.;center=2)) == (Stencil(1.,1.;center=1), Stencil(2.,2.;center=2))
     end
+
+    @testset "type inference" begin
+        s_int = CenteredStencil(1,2,3)
+        s_float = CenteredStencil(1.,2.,3.)
+        v_int = rand(1:10,10);
+        v_float = rand(10);
+
+        @inferred SbpOperators.apply_stencil(s_int, v_int, 2)
+        @inferred SbpOperators.apply_stencil(s_float, v_float, 2)
+        @inferred SbpOperators.apply_stencil(s_int,  v_float, 2)
+        @inferred SbpOperators.apply_stencil(s_float, v_int, 2)
+    end
 end
 
 @testset "NestedStencil" begin