diff 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
line wrap: on
line diff
--- a/test/testSbpOperators.jl	Sat Dec 05 13:05:53 2020 +0100
+++ b/test/testSbpOperators.jl	Sat Dec 05 13:07:07 2020 +0100
@@ -19,6 +19,15 @@
     @test SbpOperators.Stencil((1,2,3,4), center=4) == SbpOperators.Stencil((-3, 0),(1,2,3,4))
 end
 
+@testset "parse_rational" begin
+    @test SbpOperators.parse_rational("1") isa Rational
+    @test SbpOperators.parse_rational("1") == 1//1
+    @test SbpOperators.parse_rational("1/2") isa Rational
+    @test SbpOperators.parse_rational("1/2") == 1//2
+    @test SbpOperators.parse_rational("37/13") isa Rational
+    @test SbpOperators.parse_rational("37/13") == 37//13
+end
+
 # @testset "apply_quadrature" begin
 #     op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
 #     h = 0.5