11 #define BOOST_TEST_MODULE ( datasize_test )
12 #include <boost/test/unit_test.hpp>
19 #include <type_traits>
25 using namespace util::quantities::datasize_literals;
27 constexpr
auto s_B = 256_B;
29 static_assert(s_B.value() == 256U);
30 static_assert(s_B == 256_B);
31 std::cout <<
"Tested " << s_B << std::endl;
33 constexpr
auto s_kiB = 4_kiB;
36 static_assert(s_kiB == 4_kiB);
37 static_assert(s_kiB.value() == 4U);
38 static_assert(s_kiB == 4096_B);
39 std::cout <<
"Tested " << s_kiB << std::endl;
41 constexpr
auto s_MiB = 4_MiB;
44 static_assert(s_MiB == 4_MiB);
45 static_assert(s_MiB.value() == 4U);
46 static_assert(s_MiB == 4096_kiB);
47 std::cout <<
"Tested " << s_MiB << std::endl;
49 constexpr
auto s_GiB = 4_GiB;
52 static_assert(s_GiB == 4_GiB);
53 static_assert(s_GiB.value() == 4U);
54 static_assert(s_GiB == 4096_MiB);
55 std::cout <<
"Tested " << s_GiB << std::endl;
57 constexpr
auto s_TiB = 4_TiB;
60 static_assert(s_TiB == 4_TiB);
61 static_assert(s_TiB.value() == 4U);
62 static_assert(s_TiB == 4096_GiB);
63 std::cout <<
"Tested " << s_TiB << std::endl;
65 constexpr
auto s_PiB = 4_PiB;
68 static_assert(s_PiB == 4_PiB);
69 static_assert(s_PiB.value() == 4U);
70 static_assert(s_PiB == 4096_TiB);
71 std::cout <<
"Tested " << s_PiB << std::endl;
73 constexpr
auto s_EiB = 4_EiB;
76 static_assert(s_EiB == 4_EiB);
77 static_assert(s_EiB.value() == 4U);
78 static_assert(s_EiB == 4096_PiB);
79 std::cout <<
"Tested " << s_EiB << std::endl;
void test_datasize_literals()
A value measured in the specified unit.
BEGIN_PROLOG could also be cout
Dimensioned variables representing data size.