diff test/SbpOperators/stencil_test.jl @ 894:54e36688dab8 feature/variable_derivatives

Add functions for converting the element type of nested stencils
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Feb 2022 10:57:00 +0100
parents 0be29e65521e
children 004324d7ed35
line wrap: on
line diff
--- a/test/SbpOperators/stencil_test.jl	Thu Feb 10 10:02:33 2022 +0100
+++ b/test/SbpOperators/stencil_test.jl	Thu Feb 10 10:57:00 2022 +0100
@@ -60,11 +60,19 @@
             center=1
         ))
 
-
         @testset "Error handling" begin
         end
     end
 
+    @testset "conversion" begin
+        ns = NestedStencil((-1,1,0),(-1,0,1),(0,-1,1), center=2)
+        @test NestedStencil{Float64}(ns) == NestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.), center=2)
+        @test NestedStencil{Rational}(ns) == NestedStencil((-1//1,1//1,0//1),(-1//1,0//1,1//1),(0//1,-1//1,1//1), center=2)
+
+        @test convert(NestedStencil{Float64}, ns) == NestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-1.,1.), center=2)
+        @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 "apply" begin
         c = [  1,  3,  6, 10, 15, 21, 28, 36, 45, 55]
         v = [  2,  3,  5,  7, 11, 13, 17, 19, 23, 29]