Skip to content

Commit 44ed9e4

Browse files
committed
Expand uconvert tests
1 parent 0e5848b commit 44ed9e4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/unittests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,14 @@ end
605605

606606
# Refuses to convert to non-unit quantities:
607607
@test_throws ErrorException uconvert(1.2us"m", 1.0u"m")
608+
VERSION >= v"1.8" &&
609+
@test_throws "You passed a quantity" uconvert(1.2us"m", 1.0u"m")
610+
611+
# Different types require converting both arguments:
612+
q = convert(Quantity{Float16}, 1.5u"g")
613+
qs = uconvert(convert(Quantity{Float16}, us"g"), 5 * q)
614+
@test typeof(qs) <: Quantity{Float16,<:SymbolicDimensions{<:Any}}
615+
@test qs 7.5us"g"
608616
end
609617

610618
@testset "Test ambiguities" begin

0 commit comments

Comments
 (0)