comparison test/testSbpOperators.jl @ 603:fbff4009c08a refactor/toml_operator_format

Add tests for parse_rational()
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 05 Dec 2020 13:07:07 +0100
parents 03ef4d4740ab
children 8fcf9c9afb30
comparison
equal deleted inserted replaced
602:c2239c7cd71e 603:fbff4009c08a
15 @test SbpOperators.scale(s, 2) == SbpOperators.Stencil((-2,2), (2.,4.,4.,6.,8.)) 15 @test SbpOperators.scale(s, 2) == SbpOperators.Stencil((-2,2), (2.,4.,4.,6.,8.))
16 16
17 @test SbpOperators.Stencil((1,2,3,4), center=1) == SbpOperators.Stencil((0, 3),(1,2,3,4)) 17 @test SbpOperators.Stencil((1,2,3,4), center=1) == SbpOperators.Stencil((0, 3),(1,2,3,4))
18 @test SbpOperators.Stencil((1,2,3,4), center=2) == SbpOperators.Stencil((-1, 2),(1,2,3,4)) 18 @test SbpOperators.Stencil((1,2,3,4), center=2) == SbpOperators.Stencil((-1, 2),(1,2,3,4))
19 @test SbpOperators.Stencil((1,2,3,4), center=4) == SbpOperators.Stencil((-3, 0),(1,2,3,4)) 19 @test SbpOperators.Stencil((1,2,3,4), center=4) == SbpOperators.Stencil((-3, 0),(1,2,3,4))
20 end
21
22 @testset "parse_rational" begin
23 @test SbpOperators.parse_rational("1") isa Rational
24 @test SbpOperators.parse_rational("1") == 1//1
25 @test SbpOperators.parse_rational("1/2") isa Rational
26 @test SbpOperators.parse_rational("1/2") == 1//2
27 @test SbpOperators.parse_rational("37/13") isa Rational
28 @test SbpOperators.parse_rational("37/13") == 37//13
20 end 29 end
21 30
22 # @testset "apply_quadrature" begin 31 # @testset "apply_quadrature" begin
23 # op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4) 32 # op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
24 # h = 0.5 33 # h = 0.5