|
1 | 1 | using DynamicQuantities
|
2 |
| -using DynamicQuantities: DEFAULT_DIM_TYPE |
| 2 | +using DynamicQuantities: DEFAULT_DIM_TYPE, DEFAULT_VALUE_TYPE, DIMENSION_NAMES |
3 | 3 | using Ratios: SimpleRatio
|
4 | 4 | using SaferIntegers: SafeInt16
|
5 | 5 | using Test
|
|
136 | 136 | @test Quantity(0.5, length=2) / Dimensions(length=1) == Quantity(0.5, length=1)
|
137 | 137 | @test Dimensions(length=1) / Quantity(0.5, length=2, mass=-5) == Quantity(2, length=-1, mass=5)
|
138 | 138 |
|
| 139 | + @test Dimensions{Int8}([0 for i=1:length(DIMENSION_NAMES)]...) == Dimensions{Int8}() |
| 140 | + |
| 141 | + @test zero(Quantity{ComplexF64,Int8}) + Quantity(1) == Quantity(1.0+0.0im, length=Int8(0)) |
| 142 | + @test one(Quantity{ComplexF64,Int8}) - Quantity(1) == Quantity(0.0+0.0im, length=Int8(0)) |
| 143 | + @test typeof(one(Dimensions{Int16})) == Dimensions{Int16} |
| 144 | + @test one(Dimensions{Int16}) == Dimensions(mass=Int16(0)) |
| 145 | + |
| 146 | + @test zero(Quantity{ComplexF64}) == Quantity(0.0+0.0im) |
| 147 | + @test one(Quantity{ComplexF64}) == Quantity(1.0+0.0im) |
| 148 | + |
| 149 | + @test zero(Quantity) == Quantity(0.0) |
| 150 | + @test typeof(zero(Quantity)) == Quantity{DEFAULT_VALUE_TYPE,DEFAULT_DIM_TYPE} |
| 151 | + @test one(Quantity) - Quantity(1) == Quantity(0.0) |
| 152 | + @test typeof(one(Quantity)) == Quantity{DEFAULT_VALUE_TYPE,DEFAULT_DIM_TYPE} |
| 153 | + @test typeof(one(Dimensions)) == Dimensions{DEFAULT_DIM_TYPE} |
| 154 | + @test one(Dimensions) == Dimensions() |
| 155 | + |
139 | 156 | @test sqrt(z * -1) == Quantity(sqrt(52), length=1 // 2, mass=1)
|
140 | 157 | @test cbrt(z) == Quantity(cbrt(-52), length=1 // 3, mass=2 // 3)
|
141 | 158 |
|
|
0 commit comments