Skip to content

Commit 667c162

Browse files
committed
Add fld/cld tests, but they still seem wrong, and abs/neg
1 parent 7793ffc commit 667c162

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/FixedDecimal.jl

+19
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,25 @@ end
828828
@test typemax(FD2) ÷ eps(FD2) == FD2(-1)
829829
@test typemin(FD2) ÷ eps(FD2) == FD2(0)
830830
end
831+
832+
@testset "fld / cld" begin
833+
# TODO(PR): Is this the expected value?
834+
@test fld(typemax(FD2), FD2(0.5)) == FD2(-0.16)
835+
@test fld(typemin(FD2), FD2(0.5)) == FD2(-0.84)
836+
@test fld(typemax(FD2), eps(FD2)) == FD2(-1)
837+
@test fld(typemin(FD2), eps(FD2)) == FD2(0)
838+
839+
# TODO(PR): Is this the expected value?
840+
@test cld(typemax(FD2), FD2(0.5)) == FD2(0.84)
841+
@test cld(typemin(FD2), FD2(0.5)) == FD2(0.16)
842+
@test cld(typemax(FD2), eps(FD2)) == FD2(-1)
843+
@test cld(typemin(FD2), eps(FD2)) == FD2(0)
844+
end
845+
846+
@testset "abs / neg" begin
847+
@test abs(typemin(FD2)) == typemin(FD2)
848+
@test -(typemin(FD2)) == typemin(FD2)
849+
end
831850
end
832851

833852
@testset "isinteger" begin

0 commit comments

Comments
 (0)