@@ -11,18 +11,22 @@ import Infinities: Infinity
1111
1212 @test + ∞ ≡ ∞
1313
14- @test isless (1 , ∞)
15- @test ! isless (Inf , ∞)
16- @test ! isless (∞, Inf )
17- @test ! isless (∞, 1 )
18- @test ! isless (∞, ∞)
19- @test ! (∞ < ∞)
20- @test ∞ ≤ ∞
21- @test ! (∞ > ∞)
22- @test ∞ ≥ ∞
23-
24- @test 5 < ∞ && 5 ≤ ∞
25- @test ! (5 > ∞) && ! (5 ≥ ∞)
14+ @testset " inequalities" begin
15+ @test isless (1 , ∞)
16+ @test ! isless (Inf , ∞)
17+ @test ! isless (∞, Inf )
18+ @test ! isless (∞, 1 )
19+ @test ! isless (∞, ∞)
20+ @test ! (∞ < ∞)
21+ @test ∞ ≤ ∞
22+ @test ! (∞ > ∞)
23+ @test ∞ ≥ ∞
24+
25+ @test 5 < ∞ && 5 ≤ ∞
26+ @test ! (∞ < 5 ) && ! (∞ ≤ 5 )
27+ @test ∞ > 5 && ∞ ≥ 5
28+ @test ! (5 > ∞) && ! (5 ≥ ∞)
29+ end
2630
2731 @test ∞ + ∞ ≡ ∞
2832 @test ∞ + 1 ≡ 1 + ∞ ≡ ∞ + 1.0 ≡ 1.0 + ∞ ≡ ∞
@@ -82,7 +86,7 @@ import Infinities: Infinity
8286 @test convert (Float64, ∞) ≡ Float64 (∞) ≡ Inf
8387 @test convert (Float32, ∞) ≡ Float32 (∞) ≡ Inf32
8488 @test convert (Float16, ∞) ≡ Float16 (∞) ≡ Inf16
85- @test convert (BigFloat, ∞):: BigFloat == BigFloat (Inf )
89+ @test convert (BigFloat, ∞):: BigFloat == BigFloat (∞) :: BigFloat == BigFloat ( Inf )
8690 end
8791
8892 @testset " checked" begin
@@ -95,6 +99,7 @@ import Infinities: Infinity
9599 @test RealInfinity (∞) ≡ convert (RealInfinity, ∞) ≡ RealInfinity () ≡
96100 RealInfinity (false ) ≡ RealInfinity (RealInfinity ())
97101
102+ @test promote_type (Infinity, RealInfinity) == RealInfinity
98103 @test promote (∞, RealInfinity ()) ≡ (RealInfinity (),RealInfinity ())
99104
100105 @test - ∞ ≡ RealInfinity (true )
@@ -196,7 +201,8 @@ import Infinities: Infinity
196201 @test checked_sub (5 , ∞) ≡ checked_sub (5 , RealInfinity ()) ≡ - ∞
197202 @test checked_sub (- ∞, 5 ) ≡ - ∞
198203 @test checked_add (5 , - ∞) ≡ checked_add (- ∞, 5 ) ≡ - ∞
199- @test checked_mul (- 5 , ∞) ≡ - ∞
204+ @test checked_mul (- 5 , ∞) ≡ checked_mul (∞, - 5 ) ≡ - ∞
205+ @test checked_mul (- 5 , - ∞) ≡ checked_mul (- ∞, - 5 ) ≡ RealInfinity ()
200206 end
201207 end
202208
@@ -211,6 +217,7 @@ import Infinities: Infinity
211217 @test ! isfinite (ComplexInfinity ())
212218
213219 @test promote (∞, RealInfinity (), ComplexInfinity ()) ≡ ntuple (_ -> ComplexInfinity (), 3 )
220+ @test promote_type (Infinity, ComplexInfinity{Bool}) == promote_type (RealInfinity, ComplexInfinity{Bool}) == ComplexInfinity{Bool}
214221
215222
216223 @test ComplexInfinity (∞) == ∞
@@ -223,6 +230,8 @@ import Infinities: Infinity
223230 @test RealInfinity () + im ≡ im + RealInfinity () ≡ RealInfinity () + 1.0im ≡ 1.0im + RealInfinity () ≡ RealInfinity () - im ≡ RealInfinity () - 1.0im ≡ ComplexInfinity ()
224231
225232 @test im - ∞ ≡ 1.0im - ∞ ≡ - ComplexInfinity ()
233+ @test im - ComplexInfinity () ≡ 1.0im - ComplexInfinity () ≡ - ComplexInfinity ()
234+ @test ComplexInfinity () - im ≡ ComplexInfinity () - 1.0im ≡ ComplexInfinity ()
226235
227236 @test ComplexInfinity () + ∞ ≡ ComplexInfinity () + RealInfinity () ≡
228237 ∞ + ComplexInfinity () ≡ RealInfinity () + ComplexInfinity () ≡ ComplexInfinity ()
@@ -235,6 +244,7 @@ import Infinities: Infinity
235244 ComplexInfinity () * ∞ ≡ ComplexInfinity () * RealInfinity () ≡ ComplexInfinity ()
236245
237246 @test 2.0im * ∞ ≡ ∞* 2.0im ≡ 2.0im * RealInfinity () ≡ RealInfinity () * 2.0im ≡ ComplexInfinity (1 / 2 )
247+ @test 2 ComplexInfinity () ≡ ComplexInfinity ()* 2 ≡ ComplexInfinity ()
238248
239249 @test exp (im* π/ 4 )* ∞ == Inf + im* Inf
240250 @test exp (im* π/ 4 )+ ∞ == ∞
@@ -247,7 +257,9 @@ import Infinities: Infinity
247257 @test ! isless (ComplexInfinity (), 5 )
248258
249259 @test 5 < ComplexInfinity () && 5 ≤ ComplexInfinity ()
260+ @test ! (ComplexInfinity () < 5 ) && ! (ComplexInfinity () ≤ 5 )
250261 @test 5 > - ComplexInfinity () && 5 ≥ - ComplexInfinity ()
262+ @test ComplexInfinity () > 5 && ComplexInfinity () ≥ 5
251263
252264 @test 1 + ComplexInfinity () ≡ 1.0 + ComplexInfinity () ≡ ComplexInfinity () + 1 ≡ ComplexInfinity () + 1.0 ≡ ComplexInfinity ()
253265 @test 5 * ComplexInfinity () ≡ ComplexInfinity ()
@@ -265,6 +277,11 @@ import Infinities: Infinity
265277 @test min (ComplexInfinity (), 5 ) ≡ min (5 ,ComplexInfinity ()) ≡ 5
266278 @test max (ComplexInfinity (), 5 ) ≡ max (5 ,ComplexInfinity ()) ≡ ComplexInfinity ()
267279 end
280+
281+ @testset " fld/cld/div" begin
282+ @test div (ComplexInfinity (), 5 ) ≡ fld (ComplexInfinity (), 5 ) ≡ ComplexInfinity ()
283+ @test div (- ComplexInfinity (),2 ) ≡ - ComplexInfinity ()
284+ end
268285 end
269286end
270287
0 commit comments