15 #define GETTEXT_DOMAIN "wesnoth-test"
21 #include <boost/test/auto_unit_test.hpp>
27 std::vector<std::string> fruit;
31 fruit.push_back(
"apples");
35 fruit.push_back(
"oranges");
36 fruit.push_back(
"lemons");
38 BOOST_CHECK(
utils::join(fruit) ==
"apples,oranges,lemons" );
47 BOOST_CHECK( unicode.substr(euro,
utf8::index(unicode,7)-euro) ==
"€" );
55 BOOST_CHECK( apple_u4.size() == 5 );
56 BOOST_CHECK_EQUAL( apple_u8, unicode_cast<utf8::string>(apple_u4) );
57 BOOST_CHECK_EQUAL( apple_u8, unicode_cast<utf8::string>(apple_u16) );
58 BOOST_CHECK( apple_u4 == unicode_cast<ucs4::string>(apple_u16) );
59 BOOST_CHECK( apple_u16 == unicode_cast<utf16::string>(apple_u4) );
60 BOOST_CHECK_EQUAL( apple_u8.size(), apple_u16.size() );
63 water_u4.push_back(0x6C34);
67 BOOST_CHECK_EQUAL(water_u4[0], water_u16[0]);
68 BOOST_CHECK_EQUAL(water_u8,
"\u6C34");
74 BOOST_CHECK_EQUAL(nonbmp_u8.size(), 4);
75 BOOST_CHECK_EQUAL(nonbmp_u4[0], 0x10000);
76 BOOST_CHECK_EQUAL(nonbmp_u16[0], 0xD800);
77 BOOST_CHECK_EQUAL(nonbmp_u16[1], 0xDC00);
78 BOOST_CHECK_EQUAL(nonbmp_u8, unicode_cast<utf8::string>(nonbmp_u4));
79 BOOST_CHECK_EQUAL(nonbmp_u8, unicode_cast<utf8::string>(nonbmp_u16));
80 BOOST_CHECK(nonbmp_u16 == unicode_cast<utf16::string>(nonbmp_u4));
81 BOOST_CHECK(nonbmp_u4 == unicode_cast<ucs4::string>(nonbmp_u16));
126 BOOST_AUTO_TEST_SUITE_END()
std::vector< char_t > string
size_t index(const utf8::string &str, const size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::vector< char_t > string
ucs4_convert_impl::enableif< TD, typename TS::value_type >::type unicode_cast(const TS &source)
bool wildcard_string_match(const std::string &str, const std::string &match)
Match using '*' as any number of characters (including none), and '?' as any one character.
utf8::string lowercase(const utf8::string &s)
Returns a lowercased version of the string.
BOOST_AUTO_TEST_SUITE(test_map_location)
utf8::string & truncate(utf8::string &str, const size_t size)
Truncates a UTF-8 string to the specified number of characters.
std::string join(T const &v, const std::string &s=",")
Generates a new string joining container items in a list.
BOOST_AUTO_TEST_CASE(utils_join_test)
size_t size(const utf8::string &str)
Length in characters of a UTF-8 string.
GLsizei const GLcharARB ** string