11package com.raynigon.unit.api.core.units.si
22
3+ import com.raynigon.unit.api.core.service.UnitsApiService
34import com.raynigon.unit.api.core.units.si.acceleration.MetrePerSquaredSecond
45import com.raynigon.unit.api.core.units.si.energy.Joule
56import com.raynigon.unit.api.core.units.si.energy.KiloWattHour
@@ -17,12 +18,10 @@ import com.raynigon.unit.api.core.units.si.temperature.Kelvin
1718import com.raynigon.unit.api.core.units.si.time.Hour
1819import com.raynigon.unit.api.core.units.si.time.Minute
1920import com.raynigon.unit.api.core.units.si.time.Second
21+ import com.raynigon.unit.api.core.units.si.torque.NewtonMetre
2022import spock.lang.Specification
2123import spock.lang.Unroll
2224
23- import static com.raynigon.unit.api.core.service.UnitsApiService.quantity
24-
25-
2625class SISystemSpec extends Specification {
2726
2827 @Unroll
@@ -59,54 +58,59 @@ class SISystemSpec extends Specification {
5958 " km/h" | new KilometrePerHour ()
6059 // temperature
6160 " K" | new Kelvin ()
61+ " °C" | new Celsius ()
6262 " \u 2103" | new Celsius ()
6363 // time
6464 " s" | new Second ()
6565 " min" | new Minute ()
6666 " h" | new Hour ()
67+ // torque
68+ " N m" | new NewtonMetre ()
69+ " N·m" | new NewtonMetre ()
70+ " N⋅m" | new NewtonMetre ()
6771 }
6872
6973 def ' metre conversion' () {
7074
7175 when :
72- def quantity = quantity(initialValue, unit)
76+ def quantity = UnitsApiService . quantity(initialValue, unit)
7377
7478 then :
7579 expectedValue == quantity. to(new Metre ()). value. intValue()
7680
7781 where :
7882 unit | initialValue | expectedValue
79- new Metre () | 1 | 1
80- new Millimetre () | 1000 | 1
81- new Kilometre () | 1 | 1000
83+ new Metre () | 1 | 1
84+ new Millimetre () | 1000 | 1
85+ new Kilometre () | 1 | 1000
8286 }
8387
8488 def ' energy conversion' () {
8589
8690 when :
87- def quantity = quantity(initialValue, unit)
91+ def quantity = UnitsApiService . quantity(initialValue, unit)
8892
8993 then :
9094 expectedValue == quantity. to(new Joule ()). value. intValue()
9195
9296 where :
9397 unit | initialValue | expectedValue
94- new Joule () | 1 | 1
95- new WattHour () | 1 | 3600
96- new KiloWattHour () | 1 | 3600000
98+ new Joule () | 1 | 1
99+ new WattHour () | 1 | 3600
100+ new KiloWattHour () | 1 | 3600000
97101 }
98102
99103 def ' speed conversion' () {
100104
101105 when :
102- def quantity = quantity(initialValue, unit)
106+ def quantity = UnitsApiService . quantity(initialValue, unit)
103107
104108 then :
105109 expectedValue == quantity. to(new MetrePerSecond ()). value. intValue()
106110
107111 where :
108112 unit | initialValue | expectedValue
109- new MetrePerSecond () | 1 | 1
110- new KilometrePerHour () | 36 | 10
113+ new MetrePerSecond () | 1 | 1
114+ new KilometrePerHour () | 36 | 10
111115 }
112116}
0 commit comments