Skip to content

Commit 3ac5111

Browse files
committed
Add tests for FixedRational -> Bool
1 parent f185a56 commit 3ac5111

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/unittests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ end
407407
@testset "Additional tests of FixedRational" begin
408408
@test convert(Int64, FixedRational{Int64,1000}(2 // 1)) == 2
409409
@test convert(Int32, FixedRational{Int64,1000}(3 // 1)) == 3
410+
@test convert(Bool, FixedRational{Int8,6}(1//1)) === true
411+
@test convert(Bool, FixedRational{Int8,6}(0//1)) === false
412+
413+
@test_throws InexactError convert(Int32, FixedRational{Int8,6}(2//3))
414+
@test_throws InexactError convert(Bool, FixedRational{Int8,6}(2//1))
410415

411416
VERSION >= v"1.8" && @test_throws "Refusing to" promote(FixedRational{Int,10}(2), FixedRational{Int,4}(2))
412417

0 commit comments

Comments
 (0)