11 #define BOOST_TEST_MODULE ( energy_test ) 12 #include <boost/test/unit_test.hpp> 19 #include <type_traits> 34 constexpr
auto E_eV = 13.6_eV;
37 static_assert(E_eV.value() == 13.6);
38 static_assert(E_eV == 13.6_eV);
39 std::cout <<
"Tested " << E_eV <<
std::endl;
41 constexpr
auto E_meV = 34.8_meV;
44 static_assert(E_meV == 34.8_meV);
45 static_assert(E_meV.value() == 34.8);
46 static_assert(E_meV == 0.0348_eV);
47 std::cout <<
"Tested " << E_meV <<
std::endl;
49 constexpr
auto E_ueV = 662.6_ueV;
52 static_assert(E_ueV == 662.6_ueV);
53 static_assert(E_ueV.value() == 662.6);
54 static_assert(E_ueV == 0.6626_meV);
55 std::cout <<
"Tested " << E_ueV <<
std::endl;
57 constexpr
auto E_keV = 510.99893_keV;
60 static_assert(E_keV == 510.99893_keV);
61 static_assert(E_keV.value() == 510.99893);
62 static_assert(E_keV == 0.51099893_MeV);
63 std::cout <<
"Tested " << E_keV <<
std::endl;
65 constexpr
auto E_MeV = 2.22452_MeV;
68 static_assert(E_MeV == 2.22452_MeV);
69 static_assert(E_MeV.value() == 2.22452);
70 static_assert(E_MeV == 2224.52_keV);
71 std::cout <<
"Tested " << E_MeV <<
std::endl;
73 constexpr
auto E_GeV = 91.1876_GeV;
76 static_assert(E_GeV == 91.1876_GeV);
77 static_assert(E_GeV.value() == 91.1876);
78 static_assert(E_GeV == 91187.6_MeV);
79 std::cout <<
"Tested " << E_GeV <<
std::endl;
81 constexpr
auto E_TeV = 0.980_TeV;
84 static_assert(E_TeV == 0.980_TeV);
85 static_assert(E_TeV.value() == 0.980);
86 static_assert(E_TeV == 980_GeV);
87 std::cout <<
"Tested " << E_TeV <<
std::endl;
Literal constants for energy quantities.
A value measured in the specified unit.
Dimensioned variables representing energy.
QTextStream & endl(QTextStream &s)
BOOST_AUTO_TEST_CASE(electronvolt_testcase)
void test_electronvolt_literals()