13 #define BOOST_TEST_MODULE ( space_test ) 14 #include <boost/test/unit_test.hpp> 21 #include <type_traits> 36 constexpr
auto l_m = 299792458_m;
39 static_assert(l_m.value() == 299792458);
40 static_assert(l_m == 299792458_m);
41 std::cout <<
"Tested " << l_m <<
std::endl;
43 constexpr
auto l_km = 299792.458_km;
46 static_assert(l_km == 299792.458_km);
47 static_assert(l_km.value() == 299792.458);
48 static_assert(l_km == 299792458_m);
49 std::cout <<
"Tested " << l_km <<
std::endl;
51 constexpr
auto l_cm = 29979245800_cm;
52 static_assert(std::is_same<decltype
54 static_assert(l_cm == 29979245800_cm);
55 static_assert(l_cm.value() == 29979245800);
56 static_assert(l_cm == 299792458_m);
57 std::cout <<
"Tested " << l_cm <<
std::endl;
59 constexpr
auto l_mm = 299792458000_mm;
62 static_assert(l_mm == 299792458000_mm);
63 static_assert(l_mm.value() == 299792458000);
64 static_assert(l_mm == 299792458_m);
65 std::cout <<
"Tested " << l_mm <<
std::endl;
67 constexpr
auto l_um = 1063_um;
70 static_assert(l_um == 1063_um);
71 static_assert(l_um.value() == 1063);
72 static_assert(l_um == 1.063_mm);
73 std::cout <<
"Tested " << l_um <<
std::endl;
75 constexpr
auto l_nm = 1063000_nm;
78 static_assert(l_nm == 1063000_nm);
79 static_assert(l_nm.value() == 1063000);
80 static_assert(l_nm == 1063_um);
81 std::cout <<
"Tested " << l_nm <<
std::endl;
83 constexpr
auto l_pm = 1063000000_pm;
86 static_assert(l_pm == 1063000000_pm);
87 static_assert(l_pm.value() == 1063000000);
88 static_assert(l_pm == 1063000_nm);
89 std::cout <<
"Tested " << l_pm <<
std::endl;
91 constexpr
auto l_fm = 52918_fm;
94 static_assert(l_fm == 52918_fm);
95 static_assert(l_fm.value() == 52918);
96 static_assert(l_fm == 52.918_pm);
97 std::cout <<
"Tested " << l_fm <<
std::endl;
BOOST_AUTO_TEST_CASE(meter_testcase)
void test_meter_literals()
A value measured in the specified unit.
Dimensioned variables representing space or time quantities.
QTextStream & endl(QTextStream &s)
Literal constants for space quantities.