|
3 | 3 | @test_throws DomainError lambertw(-2.0, 0)
|
4 | 4 | @test_throws DomainError lambertw(-2.0, -1)
|
5 | 5 | @test_throws DomainError lambertw(-2.0, 1)
|
6 |
| -@test isnan(lambertw(NaN)) |
| 6 | +@test isnan(@inferred(lambertw(NaN))) |
7 | 7 |
|
8 | 8 | ## math constant e
|
9 | 9 | @test_throws DomainError lambertw(MathConstants.e, 1)
|
10 | 10 | @test_throws DomainError lambertw(MathConstants.e, -1)
|
11 | 11 |
|
12 | 12 | ## integer arguments return floating point types
|
13 |
| -@test lambertw(0) isa AbstractFloat |
14 |
| -@test lambertw(0) == 0 |
| 13 | +@test @inferred(lambertw(0)) isa AbstractFloat |
| 14 | +@test @inferred(lambertw(0)) == 0 |
15 | 15 |
|
16 | 16 | ### math constant, MathConstants.e e
|
17 | 17 |
|
18 | 18 | # could return math const e, but this would break type stability
|
19 |
| -@test lambertw(1) isa AbstractFloat |
20 |
| -@test lambertw(MathConstants.e, 0) == 1 |
| 19 | +@test @inferred(lambertw(1)) isa AbstractFloat |
| 20 | +@test @inferred(lambertw(MathConstants.e, 0)) == 1 |
21 | 21 |
|
22 | 22 | ## value at branch point where real branches meet
|
23 | 23 | @test lambertw(-inv(MathConstants.e), 0) == lambertw(-inv(MathConstants.e), -1) == -1
|
24 | 24 | @test typeof(lambertw(-inv(MathConstants.e), 0)) == typeof(lambertw(-inv(MathConstants.e), -1)) <: AbstractFloat
|
25 | 25 |
|
26 | 26 | ## convert irrationals to float
|
27 | 27 |
|
28 |
| -@test isapprox(lambertw(pi), 1.0736581947961492) |
29 |
| -@test isapprox(lambertw(pi, 0), 1.0736581947961492) |
| 28 | +@test isapprox(@inferred(lambertw(pi)), 1.0736581947961492) |
| 29 | +@test isapprox(@inferred(lambertw(pi, 0)), 1.0736581947961492) |
30 | 30 |
|
31 | 31 | ### infinite args or return values
|
32 | 32 |
|
33 | 33 | @test lambertw(0, -1) == lambertw(0.0, -1) == -Inf
|
34 | 34 | @test lambertw(Inf, 0) == Inf
|
35 |
| -@test lambertw(complex(Inf, 1), 0) == complex(Inf, 1) |
| 35 | +@test @inferred(lambertw(complex(Inf, 1), 0)) == complex(Inf, 1) |
36 | 36 | @test lambertw(complex(Inf, 0), 1) == complex(Inf, 2pi)
|
37 | 37 | @test lambertw(complex(-Inf, 0), 1) == complex(Inf, 3pi)
|
38 |
| -@test lambertw(complex(0.0, 0.0), -1) == complex(-Inf, 0.0) |
| 38 | +@test @inferred(lambertw(complex(0.0, 0.0), -1)) == complex(-Inf, 0.0) |
39 | 39 |
|
40 | 40 | ## default branch is k = 0
|
41 | 41 | @test lambertw(1.0) == lambertw(1.0, 0)
|
42 | 42 |
|
43 | 43 | ## BigInt args return BigFloats
|
44 |
| -@test typeof(lambertw(BigInt(0))) == BigFloat |
45 |
| -@test typeof(lambertw(BigInt(3))) == BigFloat |
| 44 | +@test @inferred(lambertw(BigInt(0))) isa BigFloat |
| 45 | +@test @inferred(lambertw(BigInt(3))) isa BigFloat |
46 | 46 |
|
47 | 47 | ## Any Integer type allowed for second argument
|
48 | 48 | @test lambertw(-0.2, -1) == lambertw(-0.2, BigInt(-1))
|
|
145 | 145 |
|
146 | 146 | # test the expansion about branch point for k=-1,
|
147 | 147 | # by comparing to exact BigFloat calculation.
|
148 |
| -@test lambertwbp(1e-20, -1) - 1 - lambertw(-inv(big(MathConstants.e)) + BigFloat(10)^BigFloat(-20), -1) < 1e-16 |
| 148 | +@test @inferred(lambertwbp(1e-20, -1)) - 1 - lambertw(-inv(big(MathConstants.e)) + BigFloat(10)^BigFloat(-20), -1) < 1e-16 |
149 | 149 |
|
150 |
| -@test abs(lambertwbp(Complex(.01, .01), -1) - Complex(-0.2755038208041206, -0.1277888928494641)) < 1e-14 |
| 150 | +@test abs(@inferred(lambertwbp(Complex(.01, .01), -1)) - Complex(-0.2755038208041206, -0.1277888928494641)) < 1e-14 |
151 | 151 |
|
152 | 152 | end # if Int != Int32
|
0 commit comments