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 30aef4f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/FixedDecimal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ end
end

@testset "division" begin
# TODO(PR): Is this the expected value?
@test typemax(FD2) / FD2(0.5) == FD2(-0.02)
@test typemin(FD2) / FD2(0.5) == FD2(0)
end
Expand All @@ -828,6 +829,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 30aef4f

Please sign in to comment.