From 7efa6c9d52f5bc6b0990582241f7e5f2558cc53b Mon Sep 17 00:00:00 2001 From: Bagaev Dmitry Date: Thu, 29 Sep 2022 13:15:52 +0200 Subject: [PATCH] more tests --- test/runtests.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index ba4e352..775091f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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]