@@ -16,6 +16,8 @@ bool is_near_equal(const unlib::quantity<D,S1,F,T> lhs, const unlib::quantity<D,
1616 return unlib::is_near (lhs, rhs, unlib::tolerance_nominal (max (lhs,rhs)));
1717}
1818
19+ using VT = long long ;
20+
1921}
2022
2123TEST_CASE (" common quantities" ) {
@@ -59,8 +61,6 @@ TEST_CASE("common quantities") {
5961 using unlib::literals::get_quantity_string;
6062
6163 SUBCASE (" time" ) {
62- using VT = long long ;
63-
6464 const unlib::second<VT> s{ 1 }; CHECK (get_quantity_string ( s) == " s" ); REQUIRE (s.get () == 1 );
6565
6666 unlib::milli<unlib::second<VT>> ms{ s}; CHECK (get_quantity_string (ms) == " ms" ); CHECK (ms.get () == s.get () * 1000 );
@@ -104,8 +104,6 @@ TEST_CASE("common quantities") {
104104 }
105105
106106 SUBCASE (" mass" ) {
107- using VT = long long ;
108-
109107 unlib::kilo <unlib::gram<VT>> kg{ 1 }; CHECK (get_quantity_string (kg) == " kg" ); REQUIRE (kg.get () == 1 );
110108
111109 unlib::gram<VT> g{kg}; CHECK (get_quantity_string ( g) == " g" ); REQUIRE (kg.get ()); CHECK ( g.get () == kg.get () * 1000 );
@@ -148,8 +146,6 @@ TEST_CASE("common quantities") {
148146 }
149147
150148 SUBCASE (" length" ) {
151- using VT = long long ;
152-
153149 const unlib::kilo<unlib::meter<VT>> km{ 1 }; CHECK (get_quantity_string (km) == " km" ); REQUIRE (km.get () == 1 );
154150
155151 unlib::femto<unlib::meter<VT>> fm{km}; CHECK (get_quantity_string (fm) == " fm" ); REQUIRE (km.get ()); CHECK (fm.get () == km.get () * 1000'000'000'000'000'000 );
@@ -186,8 +182,6 @@ TEST_CASE("common quantities") {
186182 }
187183
188184 SUBCASE (" area" ) {
189- using VT = long long ;
190-
191185 CHECK (typeid (unlib::area) == typeid (unlib::square_meter <VT>::unit_type)); CHECK (get_quantity_string (unlib::square_meter <VT>{}) == " m2" );
192186 CHECK (typeid (unlib::area) == typeid (unlib::square_kilometer <VT>::unit_type)); CHECK (get_quantity_string (unlib::square_kilometer <VT>{}) == " km2" );
193187 CHECK (typeid (unlib::area) == typeid (unlib:: are <VT>::unit_type));
@@ -207,8 +201,6 @@ TEST_CASE("common quantities") {
207201 }
208202
209203 SUBCASE (" volume" ) {
210- using VT = long long ;
211-
212204 CHECK (typeid (unlib::volume) == typeid (unlib::cubic_millimeter<VT>::unit_type)); CHECK (get_quantity_string (unlib::cubic_millimeter<VT>{}) == " mm3" );
213205 CHECK (typeid (unlib::volume) == typeid (unlib::cubic_centimeter<VT>::unit_type)); CHECK (get_quantity_string (unlib::cubic_centimeter<VT>{}) == " ml" );
214206 CHECK (typeid (unlib::volume) == typeid (unlib::cubic_meter <VT>::unit_type)); CHECK (get_quantity_string (unlib::cubic_meter <VT>{}) == " m3" );
@@ -228,8 +220,6 @@ TEST_CASE("common quantities") {
228220 }
229221
230222 SUBCASE (" temperature" ) {
231- using VT = long long ;
232-
233223 const unlib::degree_kelvin <VT> d_k{ 1 }; CHECK (get_quantity_string (d_k) == " K" ); REQUIRE (d_k.get () == 1 );
234224 const unlib::degree_celsius <VT> d_c{ 1 }; CHECK (get_quantity_string (d_c) == " C" ); REQUIRE (d_c.get () == 1 );
235225 const unlib::degree_fahrenheit<VT> d_f{ 1 }; CHECK (get_quantity_string (d_f) == " F" ); REQUIRE (d_f.get () == 1 );
@@ -242,8 +232,6 @@ TEST_CASE("common quantities") {
242232 }
243233
244234 SUBCASE (" current" ) {
245- using VT = long long ;
246-
247235 const unlib::ampere<VT> A{ 1 }; CHECK (get_quantity_string ( A) == " A" ); REQUIRE ( A.get () == 1 );
248236
249237 unlib::femto<unlib::ampere<VT>> fA { A}; CHECK (get_quantity_string (fA ) == " fA" ); REQUIRE ( A.get ()); CHECK (fA .get () == A.get () * 1000'000'000'000'000 );
@@ -287,8 +275,6 @@ TEST_CASE("common quantities") {
287275 }
288276
289277 SUBCASE (" frequency" ) {
290- using VT = long long ;
291-
292278 // Wikipedia: F = T^-1
293279 using frequency = unlib::unit_t < unlib::reciprocal_unit_t <unlib::time> >;
294280 CHECK ( typeid (frequency) == typeid (unlib::hertz<VT>::unit_type) );
@@ -339,8 +325,6 @@ TEST_CASE("common quantities") {
339325 }
340326
341327 SUBCASE (" voltage" ) {
342- using VT = long long ;
343-
344328 // Wikipedia: U = M?L^2?I^-1?T^-3
345329 using voltage = unlib::unit_t < unlib::mass
346330 , unlib::square_unit_t <unlib::length>
@@ -394,8 +378,6 @@ TEST_CASE("common quantities") {
394378 }
395379
396380 SUBCASE (" resistance" ) {
397- using VT = long long ;
398-
399381 // Wikipedia: R = M?L^2?I^-2?T^-3
400382 using resistance = unlib::unit_t < unlib::mass
401383 , unlib::square_unit_t <unlib::length>
@@ -449,8 +431,6 @@ TEST_CASE("common quantities") {
449431 }
450432
451433 SUBCASE (" power" ) {
452- using VT = long long ;
453-
454434 using power = unlib::unit_t < unlib::mass
455435 , unlib::square_unit_t <unlib::length>
456436 , unlib::reciprocal_unit_t <unlib::cube_unit_t <unlib::time>> >;
@@ -544,8 +524,6 @@ TEST_CASE("common quantities") {
544524 }
545525
546526 SUBCASE (" energy" ) {
547- using VT = long long ;
548-
549527 // Wikipedia: E = L^2?M?T^-2
550528 using energy = unlib::unit_t < unlib::square_unit_t <unlib::length>
551529 , unlib::mass
@@ -611,8 +589,6 @@ TEST_CASE("common quantities") {
611589 }
612590
613591 SUBCASE (" electric charge" ) {
614- using VT = long long ;
615-
616592 // Wikipedia: Q = I?T
617593 using charge = unlib::unit_t < unlib::current
618594 , unlib::time >;
@@ -670,8 +646,6 @@ TEST_CASE("common quantities") {
670646 }
671647
672648 SUBCASE (" pressure" ) {
673- using VT = long long ;
674-
675649 // Wikipedia: P = M?L^-1?T^-2
676650 using pressure = unlib::unit_t < unlib::mass
677651 , unlib::reciprocal_unit_t <unlib::length>
@@ -733,8 +707,6 @@ TEST_CASE("common quantities") {
733707 }
734708
735709 SUBCASE (" velocity" ) {
736- using VT = long long ;
737-
738710 // Wikipedia: a = L?T^-1
739711 using velocity = unlib::unit_t < unlib::length
740712 , unlib::reciprocal_unit_t <unlib::time> >;
@@ -760,8 +732,6 @@ TEST_CASE("common quantities") {
760732 }
761733
762734 SUBCASE (" volumetric flow rate" ) {
763- using VT = long long ;
764-
765735 CHECK (typeid (unlib::liter_per_hour<VT>::unit_type) == typeid (unlib::volumetric_flow_rate));
766736
767737 CHECK (get_quantity_string (unlib::liter_per_hour<VT>{}) == " l/h" );
@@ -774,8 +744,6 @@ TEST_CASE("common quantities") {
774744 }
775745
776746 SUBCASE (" scalar" ) {
777- using VT = long long ;
778-
779747 CHECK (typeid (unlib::scalar <VT,unlib::no_tag>::unit_type) == typeid (unlib::dimensionless));
780748 CHECK (typeid (unlib::fraction<VT >::unit_type) == typeid (unlib::dimensionless));
781749 CHECK (typeid (unlib::percent <VT >::unit_type) == typeid (unlib::dimensionless));
0 commit comments