win32.cpp (743B)
1 #include "helper.hpp" 2 3 #include <win32.hpp> 4 5 static const char *M = "[win32]"; 6 7 TEST_CASE("widen string", M) { 8 SECTION("ascii") { 9 const auto &wide = Win32::widen("hello world"); 10 REQUIRE(wide == L("hello world")); 11 REQUIRE(wide.size() == 11); 12 } 13 14 SECTION("cyrillic") { 15 const auto &wide = Win32::widen("世界"); 16 REQUIRE(wide == L("\u4e16\u754c")); 17 #ifdef _WIN32 18 REQUIRE(wide.size() == 2); 19 #else 20 REQUIRE(wide.size() == 6); 21 #endif 22 } 23 } 24 25 TEST_CASE("narrow string", M) { 26 SECTION("ascii") { 27 const auto &narrow = Win32::narrow(L("hello world")); 28 REQUIRE(narrow == "hello world"); 29 } 30 31 SECTION("cyrillic") { 32 const auto &narrow = Win32::narrow(L("\u4e16\u754c")); 33 REQUIRE(narrow == "世界"); 34 } 35 }