15 #define GETTEXT_DOMAIN "wesnoth-test"
17 #include <boost/test/unit_test.hpp>
21 #include <boost/cstdint.hpp>
29 BOOST_CHECK( result == 1 );
32 BOOST_CHECK( result2 == 2 );
60 BOOST_CHECK( result == 1 );
63 BOOST_CHECK( result2 == 2 );
65 double result3 = lexical_cast_default<double, const std::string&>(
std::string(
"0.5"));
66 BOOST_CHECK( result3 >= 0.499 && result3 <= 0.511 );
69 int result4 = lexical_cast_default<int, const std::string&>(
std::string(), 4);
70 BOOST_CHECK( result4 == 4 );
73 BOOST_CHECK( result5 == 5 );
75 double result6 = lexical_cast_default<double, const std::string&>(
std::string(), 0.5);
76 BOOST_CHECK( result6 >= 0.499 && result6 <= 0.511 );
81 BOOST_CHECK( bit_width<boost::uint8_t>() == 8 );
82 BOOST_CHECK( bit_width<boost::uint16_t>() == 16 );
83 BOOST_CHECK( bit_width<boost::uint32_t>() == 32 );
84 BOOST_CHECK( bit_width<boost::uint64_t>() == 64 );
86 BOOST_CHECK(
bit_width(static_cast<boost::uint8_t>(0)) == 8 );
87 BOOST_CHECK(
bit_width(static_cast<boost::uint16_t>(0)) == 16 );
88 BOOST_CHECK(
bit_width(static_cast<boost::uint32_t>(0)) == 32 );
89 BOOST_CHECK(
bit_width(static_cast<boost::uint64_t>(0)) == 64 );
115 == bit_width<unsigned int>() );
117 == bit_width<unsigned long int>() );
119 == bit_width<unsigned long long int>() );
121 == bit_width<char>() );
123 == bit_width<char>() - 4 );
125 == bit_width<char>() - 5 );
127 == bit_width<char>() - 6 );
145 BOOST_AUTO_TEST_SUITE_END()
unsigned int count_leading_ones(N n)
Returns the quantity of leading 1 bits in n ā i.e., the quantity of bits in n, minus the 1-based bit...
BOOST_AUTO_TEST_SUITE(test_map_location)
int lexical_cast_default< int, const char * >(const char *a, int def)
To lexical_cast(From value)
Lexical cast converts one type to another.
BOOST_AUTO_TEST_CASE(test_lexical_cast)
unsigned int count_leading_zeros(N n)
Returns the quantity of leading 0 bits in n ā i.e., the quantity of bits in n, minus the 1-based bit...
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
Templates and utility-routines for strings and numbers.
std::size_t bit_width()
Returns the size, in bits, of an instance of type T, providing a convenient and self-documenting name...
unsigned int count_ones(N n)
Returns the quantity of 1 bits in n ā i.e., nās population count.
Thrown when a lexical_cast fails.
GLsizei const GLcharARB ** string