diff options
Diffstat (limited to 'test/unit/testUniConversion.cxx')
-rw-r--r-- | test/unit/testUniConversion.cxx | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/test/unit/testUniConversion.cxx b/test/unit/testUniConversion.cxx index 9c313390a..0327db7e1 100644 --- a/test/unit/testUniConversion.cxx +++ b/test/unit/testUniConversion.cxx @@ -28,53 +28,53 @@ TEST_CASE("UTF16Length") { SECTION("UTF16Length ASCII") { // Latin Small Letter A const char *s = "a"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example1") { // Dollar Sign const char *s = "\x24"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example2") { // Cent Sign const char *s = "\xC2\xA2"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example3") { // Euro Sign const char *s = "\xE2\x82\xAC"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example4") { // Gothic Letter Hwair const char *s = "\xF0\x90\x8D\x88"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 2U); } SECTION("UTF16Length Invalid Trail byte in lead position") { const char *s = "a\xB5yz"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 4U); } SECTION("UTF16Length Invalid Lead byte at end") { const char *s = "a\xC2"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 2U); } SECTION("UTF16Length Invalid Lead byte implies 3 trails but only 2") { const char *s = "a\xF1yz"; - size_t len = UTF16Length(s); + const size_t len = UTF16Length(s); REQUIRE(len == 2U); } } @@ -113,7 +113,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 ASCII") { const char s[] = {'a', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, tbuf, 1); + const size_t tlen = UTF16FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 'a'); } @@ -121,7 +121,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example1") { const char s[] = {'\x24', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, tbuf, 1); + const size_t tlen = UTF16FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x24); } @@ -129,7 +129,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example2") { const char s[] = {'\xC2', '\xA2', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, tbuf, 1); + const size_t tlen = UTF16FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0xA2); } @@ -137,7 +137,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example3") { const char s[] = {'\xE2', '\x82', '\xAC', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, tbuf, 1);; + const size_t tlen = UTF16FromUTF8(s, tbuf, 1);; REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x20AC); } @@ -145,7 +145,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example4") { const char s[] = {'\xF0', '\x90', '\x8D', '\x88', 0}; wchar_t tbuf[2] = {0, 0}; - size_t tlen = UTF16FromUTF8(s, tbuf, 2); + const size_t tlen = UTF16FromUTF8(s, tbuf, 2); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == 0xD800); REQUIRE(tbuf[1] == 0xDF48); @@ -154,7 +154,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Invalid Trail byte in lead position") { const char s[] = "a\xB5yz"; wchar_t tbuf[4] = {}; - size_t tlen = UTF16FromUTF8(s, tbuf, 4); + const size_t tlen = UTF16FromUTF8(s, tbuf, 4); REQUIRE(tlen == 4U); REQUIRE(tbuf[0] == 'a'); REQUIRE(tbuf[1] == 0xB5); @@ -165,7 +165,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Invalid Lead byte at end") { const char s[] = "a\xC2"; wchar_t tbuf[2] = {}; - size_t tlen = UTF16FromUTF8(s, tbuf, 2); + const size_t tlen = UTF16FromUTF8(s, tbuf, 2); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == 'a'); REQUIRE(tbuf[1] == 0xC2); @@ -174,7 +174,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Invalid Lead byte implies 3 trails but only 2") { const char *s = "a\xF1yz"; wchar_t tbuf[4] = {}; - size_t tlen = UTF16FromUTF8(s, tbuf, 4); + const size_t tlen = UTF16FromUTF8(s, tbuf, 4); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == 'a'); REQUIRE(tbuf[1] == 0xF1); @@ -185,7 +185,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 ASCII") { const char s[] = {'a', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, tbuf, 1); + const size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); } @@ -193,7 +193,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example1") { const char s[] = {'\x24', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, tbuf, 1); + const size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x24); } @@ -201,7 +201,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example2") { const char s[] = {'\xC2', '\xA2', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, tbuf, 1); + const size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0xA2); } @@ -209,7 +209,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example3") { const char s[] = {'\xE2', '\x82', '\xAC', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, tbuf, 1); + const size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x20AC); } @@ -217,7 +217,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example4") { const char s[] = {'\xF0', '\x90', '\x8D', '\x88', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, tbuf, 1); + const size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x10348); } @@ -225,7 +225,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Invalid Trail byte in lead position") { const char s[] = "a\xB5yz"; unsigned int tbuf[4] = {}; - size_t tlen = UTF32FromUTF8(s, tbuf, 4); + const size_t tlen = UTF32FromUTF8(s, tbuf, 4); REQUIRE(tlen == 4U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); REQUIRE(tbuf[1] == 0xB5); @@ -236,7 +236,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Invalid Lead byte at end") { const char s[] = "a\xC2"; unsigned int tbuf[2] = {}; - size_t tlen = UTF32FromUTF8(s, tbuf, 2); + const size_t tlen = UTF32FromUTF8(s, tbuf, 2); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); REQUIRE(tbuf[1] == 0xC2); @@ -245,7 +245,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Invalid Lead byte implies 3 trails but only 2") { const char *s = "a\xF1yz"; unsigned int tbuf[4] = {}; - size_t tlen = UTF32FromUTF8(s, tbuf, 4); + const size_t tlen = UTF32FromUTF8(s, tbuf, 4); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); REQUIRE(tbuf[1] == 0xF1); |