Skip to content

Commit 30aef4f

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

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/FixedDecimal.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ end
817817
end
818818

819819
@testset "division" begin
820+
# TODO(PR): Is this the expected value?
820821
@test typemax(FD2) / FD2(0.5) == FD2(-0.02)
821822
@test typemin(FD2) / FD2(0.5) == FD2(0)
822823
end
@@ -828,6 +829,25 @@ end
828829
@test typemax(FD2) ÷ eps(FD2) == FD2(-1)
829830
@test typemin(FD2) ÷ eps(FD2) == FD2(0)
830831
end
832+
833+
@testset "fld / cld" begin
834+
# TODO(PR): Is this the expected value?
835+
@test fld(typemax(FD2), FD2(0.5)) == FD2(-0.16)
836+
@test fld(typemin(FD2), FD2(0.5)) == FD2(-0.84)
837+
@test fld(typemax(FD2), eps(FD2)) == FD2(-1)
838+
@test fld(typemin(FD2), eps(FD2)) == FD2(0)
839+
840+
# TODO(PR): Is this the expected value?
841+
@test cld(typemax(FD2), FD2(0.5)) == FD2(0.84)
842+
@test cld(typemin(FD2), FD2(0.5)) == FD2(0.16)
843+
@test cld(typemax(FD2), eps(FD2)) == FD2(-1)
844+
@test cld(typemin(FD2), eps(FD2)) == FD2(0)
845+
end
846+
847+
@testset "abs / neg" begin
848+
@test abs(typemin(FD2)) == typemin(FD2)
849+
@test -(typemin(FD2)) == typemin(FD2)
850+
end
831851
end
832852

833853
@testset "isinteger" begin

0 commit comments

Comments
 (0)