comparison test/SbpOperators/readoperator_test.jl @ 830:21ab60cc0a5c operator_storage_array_of_table

Let parse_rational handle numbers and not just strings
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 12 Jan 2022 14:59:03 +0100
parents ca182cbb8f49
children 760c11e81fd4
comparison
equal deleted inserted replaced
829:1de10f5b2008 830:21ab60cc0a5c
11 @test SbpOperators.parse_rational("1") == 1//1 11 @test SbpOperators.parse_rational("1") == 1//1
12 @test SbpOperators.parse_rational("1/2") isa Rational 12 @test SbpOperators.parse_rational("1/2") isa Rational
13 @test SbpOperators.parse_rational("1/2") == 1//2 13 @test SbpOperators.parse_rational("1/2") == 1//2
14 @test SbpOperators.parse_rational("37/13") isa Rational 14 @test SbpOperators.parse_rational("37/13") isa Rational
15 @test SbpOperators.parse_rational("37/13") == 37//13 15 @test SbpOperators.parse_rational("37/13") == 37//13
16
17 @test SbpOperators.parse_rational(0.5) isa Rational
18 @test SbpOperators.parse_rational(0.5) == 1//2
19
20 @test SbpOperators.parse_rational("0.5") isa Rational
21 @test SbpOperators.parse_rational("0.5") == 1//2
22
23 @test SbpOperators.parse_rational(2) isa Rational
24 @test SbpOperators.parse_rational(2) == 2//1
16 end 25 end
17 26
18 @testset "readoperator" begin 27 @testset "readoperator" begin
19 toml_str = """ 28 toml_str = """
20 [meta] 29 [meta]