Skip to content

Commit

Permalink
Add fld/cld tests, but they still seem wrong, and abs/neg
Browse files Browse the repository at this point in the history
  • Loading branch information
NHDaly committed Dec 9, 2023
1 parent 7793ffc commit 667c162
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/FixedDecimal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,25 @@ end
@test typemax(FD2) ÷ eps(FD2) == FD2(-1)
@test typemin(FD2) ÷ eps(FD2) == FD2(0)
end

@testset "fld / cld" begin
# TODO(PR): Is this the expected value?
@test fld(typemax(FD2), FD2(0.5)) == FD2(-0.16)
@test fld(typemin(FD2), FD2(0.5)) == FD2(-0.84)
@test fld(typemax(FD2), eps(FD2)) == FD2(-1)
@test fld(typemin(FD2), eps(FD2)) == FD2(0)

# TODO(PR): Is this the expected value?
@test cld(typemax(FD2), FD2(0.5)) == FD2(0.84)
@test cld(typemin(FD2), FD2(0.5)) == FD2(0.16)
@test cld(typemax(FD2), eps(FD2)) == FD2(-1)
@test cld(typemin(FD2), eps(FD2)) == FD2(0)
end

@testset "abs / neg" begin
@test abs(typemin(FD2)) == typemin(FD2)
@test -(typemin(FD2)) == typemin(FD2)
end
end

@testset "isinteger" begin
Expand Down

0 comments on commit 667c162

Please sign in to comment.