|
332 | 332 |
|
333 | 333 | @testset "Convert" begin |
334 | 334 |
|
335 | | - @var x |
336 | | - s = x + 1 - x |
337 | | - |
338 | | - @test typeof(convert(Int, s)) <: Int |
339 | | - @test typeof(convert(Int32, s)) == Int32 |
340 | | - @test typeof(convert(Int64, s)) == Int64 |
341 | | - @test typeof(convert(BigInt, s)) == BigInt |
342 | | - @test typeof(convert(BigFloat, s)) == BigFloat |
343 | | - @test typeof(convert(Float64, s)) == Float64 |
344 | | - @test typeof(convert(ComplexF64, s)) == ComplexF64 |
| 335 | + @var x |
| 336 | + |
| 337 | + s = x + 1 - x |
| 338 | + @test convert(Int, s) == 1 |
| 339 | + @test convert(Int32, s) == Int32(1) |
| 340 | + @test convert(Int64, s) == Int64(1) |
| 341 | + @test convert(BigInt, s) == BigInt(1) |
| 342 | + @test convert(BigFloat, s) == BigFloat(1) |
| 343 | + @test convert(Float64, s) == Float64(1) |
| 344 | + @test convert(ComplexF64, s) == ComplexF64(1) |
| 345 | + |
| 346 | + r = x + 1.0 - x |
| 347 | + @test convert(Float64, r) == Float64(1) |
| 348 | + @test convert(ComplexF64, r) == ComplexF64(1) |
| 349 | + |
| 350 | + u = x + BigFloat(1.0) - x |
| 351 | + @test convert(BigFloat, u) == BigFloat(1.0) |
| 352 | + |
| 353 | + t = x + (1.0 + 0.0im) - x |
| 354 | + @test convert(ComplexF64, t) == ComplexF64(1) |
345 | 355 | end |
346 | 356 | end |
0 commit comments