Skip to content

Commit 7b99fed

Browse files
committed
Extra tests of NoDims
1 parent 8d646d1 commit 7b99fed

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/unittests.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using DynamicQuantities
2-
using DynamicQuantities: FixedRational
2+
using DynamicQuantities: FixedRational, NoDims
33
using DynamicQuantities: DEFAULT_QUANTITY_TYPE, DEFAULT_DIM_BASE_TYPE, DEFAULT_DIM_TYPE, DEFAULT_VALUE_TYPE
44
using DynamicQuantities: array_type, value_type, dim_type, quantity_type
55
using DynamicQuantities: GenericQuantity, with_type_parameters, constructorof
@@ -1633,6 +1633,18 @@ end
16331633
@eval @test all($f.($qx_real_dimensions, $qy_dimensions) .== $ground_truth)
16341634
@eval @test all($f.($qx_dimensions, $qy_real_dimensions) .== $ground_truth)
16351635
end
1636+
1637+
# Should be able to compare against `NoDims`:
1638+
@test Quantity(1.0) >= 1.0
1639+
@test !(Quantity(1.0) > 1.0)
1640+
end
1641+
1642+
@testset "Extra tests of `NoDims`" begin
1643+
@test promote_type(NoDims{Int16}, NoDims{Int32}) === NoDims{Int32}
1644+
1645+
# Prefer other types, always:
1646+
@test promote_type(Dimensions{Int16}, NoDims{Int32}) === Dimensions{Int16}
1647+
@test promote_type(MyDimensions{Int16}, NoDims{Int32}) === MyDimensions{Int16}
16361648
end
16371649

16381650
@testset "Test div" begin

0 commit comments

Comments
 (0)