11 #define BOOST_TEST_MODULE ( frequency_test ) 12 #include <boost/test/unit_test.hpp> 18 #include <type_traits> 26 constexpr
auto f_Hz = 2_Hz;
28 static_assert(
double(f_Hz) == 2.0);
29 static_assert(f_Hz == 2.0_Hz);
31 constexpr
auto f_kHz = 20_kHz;
34 static_assert(
double(f_kHz) == 20.0);
35 static_assert(f_kHz == 20.0_kHz);
37 constexpr
auto f_MHz = 200_MHz;
40 static_assert(
double(f_MHz) == 200.0);
41 static_assert(f_MHz == 200.0_MHz);
43 constexpr
auto f_GHz = 5_GHz;
46 static_assert(
double(f_GHz) == 5.0);
47 static_assert(f_GHz == 5.0_GHz);
60 static_assert(std::is_same<decltype(5_us * 2_MHz),
double>());
61 static_assert(5_us * 2_MHz == 10.0);
62 static_assert(5_ms * 2_MHz == 10
'000.0); 64 static_assert(std::is_same<decltype(2_MHz * 5_us), double>()); 65 static_assert(2_MHz * 5_us == 10.0); 66 static_assert(2_MHz * 5_ms == 10'000.0);
72 static_assert(10 / 5_us == 2_MHz);
73 static_assert(10
'000.0 / 5_ms == 2_MHz); 75 // --------------------------------------------------------------------------- 78 (std::is_same<decltype(10 / 2_MHz), util::quantities::microsecond>()); 79 static_assert(10 / 2_MHz == 5_us); 80 static_assert(10'000.0 / 2_MHz == 5_ms);
Dimensioned variables representing frequency quantities.
void test_frequency_literals()
Literal constants for frequency quantities.
void test_frequency_special_operations()
A value measured in the specified unit.
Literal constants for time quantities.
BOOST_AUTO_TEST_CASE(frequency_testcase)