Skip to content

Commit e134ee4

Browse files
committed
Fix up tests
1 parent fc1d927 commit e134ee4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/FixedDecimal.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ end
539539

540540
# signed integers using two's complement have one additional negative value
541541
if x < 0 && x == typemin(x)
542-
@test_throws InexactError x / -one(x)
542+
@test x / -one(x) == x # -typemin(x) == typemin(x)
543543
else
544544
@test x / -one(x) == -x
545545
end
@@ -631,7 +631,7 @@ end
631631

632632
@test_throws OverflowError Base.checked_sub(FD{Int8,2}(1), FD{Int8,2}(-1))
633633
@test_throws OverflowError Base.checked_sub(1, FD{Int8,2}(-1))
634-
@test_throws OverflowError Base.checked_sub(FD{Int8,2}(1), FD{Int8,2}(0.4))
634+
@test_throws OverflowError Base.checked_sub(FD{Int8,2}(-1), FD{Int8,2}(0.4))
635635

636636
@test_throws OverflowError Base.checked_div(FD{Int8,2}(1), FD{Int8,2}(0.5))
637637
@test_throws OverflowError Base.checked_div(1, FD{Int8,2}(0.5))
@@ -644,8 +644,10 @@ end
644644
@test_throws OverflowError checked_decimal_division(Int8(1), FD{Int8,2}(0.7))
645645
end
646646

647+
# Rounds down to 2
647648
@test_throws OverflowError Base.checked_fld(FD{Int8,2}(-1), FD{Int8,2}(0.9))
648-
@test_throws OverflowError Base.checked_cld(FD{Int8,2}(-1), FD{Int8,2}(1.1))
649+
# Rounds up to 2
650+
@test_throws OverflowError Base.checked_cld(FD{Int8,2}(1), FD{Int8,2}(0.9))
649651

650652
# Rem and Mod only throw DivideError and nothing more. They can't overflow, since
651653
# they can only return smaller values than the arguments.

0 commit comments

Comments
 (0)