@@ -379,20 +379,21 @@ end
379
379
@test ustrip (z) ≈ 60 * 60 * 24 * 365.25
380
380
381
381
# Test type stability of extreme range of units
382
- @test typeof (u " 1" ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
383
- @test typeof (u " 1f0" ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
384
- @test typeof (u " s" ^ 2 ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
385
- @test typeof (u " Ω" ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
386
- @test typeof (u " Gyr" ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
387
- @test typeof (u " fm" ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
388
- @test typeof (u " fm" ^ 2 ) == Quantity{ DEFAULT_UNIT_TYPE,DEFAULT_DIM_TYPE}
382
+ @test typeof (u " 1" ) == DEFAULT_UNIT_TYPE
383
+ @test typeof (u " 1f0" ) == DEFAULT_UNIT_TYPE
384
+ @test typeof (u " s" ^ 2 ) == DEFAULT_UNIT_TYPE
385
+ @test typeof (u " Ω" ) == DEFAULT_UNIT_TYPE
386
+ @test typeof (u " Gyr" ) == DEFAULT_UNIT_TYPE
387
+ @test typeof (u " fm" ) == DEFAULT_UNIT_TYPE
388
+ @test typeof (u " fm" ^ 2 ) == DEFAULT_UNIT_TYPE
389
389
390
390
# Test type demotion
391
- @test typeof (1 u " m" ) == Quantity{Int64 ,DEFAULT_DIM_TYPE}
391
+ @test typeof (1 u " m" ) == Quantity{Float64 ,DEFAULT_DIM_TYPE}
392
392
@test typeof (1f0 u " m" ) == Quantity{Float32,DEFAULT_DIM_TYPE}
393
393
@test typeof (1.0 u " m" ) == Quantity{Float64,DEFAULT_DIM_TYPE}
394
+ @test typeof (Float16 (1.0 )u " m" ) == Quantity{Float16,DEFAULT_DIM_TYPE}
394
395
395
- @test typeof (1 u " m^2/s" ) == Quantity{Int64 ,DEFAULT_DIM_TYPE}
396
+ @test typeof (1 u " m^2/s" ) == Quantity{Float64 ,DEFAULT_DIM_TYPE}
396
397
@test typeof (1f0 u " m^2/s" ) == Quantity{Float32,DEFAULT_DIM_TYPE}
397
398
@test typeof (1.0 u " m^2/s" ) == Quantity{Float64,DEFAULT_DIM_TYPE}
398
399
651
652
@test promote (x, y) == (x, y)
652
653
@test_throws ErrorException promote (x, convert (FixedRational{Int32,100 }, 10 ))
653
654
@test round (Missing, x) === missing
654
- @test promote_type (typeof (u " km/s" ), typeof (convert (Quantity{Float32}, u " km/s" ))) <: Quantity{Float64}
655
+ @test promote_type (typeof (1.0 u " km/s" ), typeof (convert (Quantity{Float32}, u " km/s" ))) <: Quantity{Float64}
655
656
656
657
x = 1.0 u " m"
657
658
y = missing
0 commit comments