Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Sep 29, 2022
1 parent 9a2a04a commit 7efa6c9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ struct ArbitraryFloatType <: AbstractFloat end

Base.eps(::Type{ ArbitraryFloatType }) = 0.1
Base.convert(::Type{ ArbitraryFloatType }, ::Integer) = ArbitraryFloatType() # for testing

@test repr(tiny) == "tiny"
@test repr(huge) == "huge"

@test typeof(tiny) === TinyNumber
@test typeof(huge) === HugeNumber
Expand Down Expand Up @@ -67,6 +70,11 @@ struct ArbitraryFloatType <: AbstractFloat end
@test @inferred clamp(big"0.0", tiny, huge) == big"1e-24"
@test @inferred clamp(big"1e25", tiny, huge) == big"1e+24"

for T in (Float64, Float32, BigFloat, ArbitraryFloatType)
@test promote_type(T, TinyNumber, HugeNumber) == T
@test promote_type(T, HugeNumber, TinyNumber) == T
end

for a in (1, 1.0, 0, 0.0, 1.0f0, 0.0f0, Int32(0), Int32(1), big"1", big"1.0", big"0", big"0.0")
T = typeof(a)
for v in [tiny, huge]
Expand Down

0 comments on commit 7efa6c9

Please sign in to comment.