diff test/SbpOperators/stencil_test.jl @ 745:6dd9f97fc2be

Merge in feature/selectable_tests.
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 17 Mar 2021 22:21:01 +0100
parents 6114274447f5
children 4433be383840
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/SbpOperators/stencil_test.jl	Wed Mar 17 22:21:01 2021 +0100
@@ -0,0 +1,18 @@
+using Test
+using Sbplib.SbpOperators
+import Sbplib.SbpOperators.Stencil
+
+@testset "Stencil" begin
+    s = Stencil((-2,2), (1.,2.,2.,3.,4.))
+    @test s isa Stencil{Float64, 5}
+
+    @test eltype(s) == Float64
+    @test SbpOperators.scale(s, 2) == Stencil((-2,2), (2.,4.,4.,6.,8.))
+
+    @test Stencil(1,2,3,4; center=1) == Stencil((0, 3),(1,2,3,4))
+    @test Stencil(1,2,3,4; center=2) == Stencil((-1, 2),(1,2,3,4))
+    @test Stencil(1,2,3,4; center=4) == Stencil((-3, 0),(1,2,3,4))
+
+    @test CenteredStencil(1,2,3,4,5) == Stencil((-2, 2), (1,2,3,4,5))
+    @test_throws ArgumentError CenteredStencil(1,2,3,4)
+end