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 efea2d8f4..a23d799e3 100644 --- a/test/unit/testUniConversion.cxx +++ b/test/unit/testUniConversion.cxx @@ -23,53 +23,53 @@ TEST_CASE("UTF16Length") { SECTION("UTF16Length ASCII") { // Latin Small Letter A const char *s = "a"; - size_t len = UTF16Length(s, strlen(s)); + size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example1") { // Dollar Sign const char *s = "\x24"; - size_t len = UTF16Length(s, strlen(s)); + size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example2") { // Cent Sign const char *s = "\xC2\xA2"; - size_t len = UTF16Length(s, strlen(s)); + size_t len = UTF16Length(s); REQUIRE(len == 1U); } SECTION("UTF16Length Example3") { // Euro Sign const char *s = "\xE2\x82\xAC"; - size_t len = UTF16Length(s, strlen(s)); + 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, strlen(s)); + 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, strlen(s)); + 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, strlen(s)); + 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, strlen(s)); + size_t len = UTF16Length(s); REQUIRE(len == 2U); } } @@ -108,7 +108,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 ASCII") { const char s[] = {'a', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, 1, tbuf, 1); + size_t tlen = UTF16FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 'a'); } @@ -116,7 +116,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example1") { const char s[] = {'\x24', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, 1, tbuf, 1); + size_t tlen = UTF16FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x24); } @@ -124,7 +124,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example2") { const char s[] = {'\xC2', '\xA2', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, 2, tbuf, 1); + size_t tlen = UTF16FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0xA2); } @@ -132,7 +132,7 @@ TEST_CASE("UniConversion") { SECTION("UTF16FromUTF8 Example3") { const char s[] = {'\xE2', '\x82', '\xAC', 0}; wchar_t tbuf[1] = {0}; - size_t tlen = UTF16FromUTF8(s, 3, tbuf, 1);; + size_t tlen = UTF16FromUTF8(s, tbuf, 1);; REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x20AC); } @@ -140,7 +140,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, 4, tbuf, 2); + size_t tlen = UTF16FromUTF8(s, tbuf, 2); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == 0xD800); REQUIRE(tbuf[1] == 0xDF48); @@ -149,7 +149,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, 4, tbuf, 4); + size_t tlen = UTF16FromUTF8(s, tbuf, 4); REQUIRE(tlen == 4U); REQUIRE(tbuf[0] == 'a'); REQUIRE(tbuf[1] == 0xB5); @@ -160,7 +160,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, 2, tbuf, 2); + size_t tlen = UTF16FromUTF8(s, tbuf, 2); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == 'a'); REQUIRE(tbuf[1] == 0xC2); @@ -169,7 +169,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, 4, tbuf, 4); + size_t tlen = UTF16FromUTF8(s, tbuf, 4); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == 'a'); REQUIRE(tbuf[1] == 0xF1); @@ -180,7 +180,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 ASCII") { const char s[] = {'a', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, 1, tbuf, 1); + size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); } @@ -188,7 +188,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example1") { const char s[] = {'\x24', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, 1, tbuf, 1); + size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x24); } @@ -196,7 +196,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example2") { const char s[] = {'\xC2', '\xA2', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, 2, tbuf, 1); + size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0xA2); } @@ -204,7 +204,7 @@ TEST_CASE("UniConversion") { SECTION("UTF32FromUTF8 Example3") { const char s[] = {'\xE2', '\x82', '\xAC', 0}; unsigned int tbuf[1] = {0}; - size_t tlen = UTF32FromUTF8(s, 3, tbuf, 1); + size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x20AC); } @@ -212,7 +212,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, 4, tbuf, 1); + size_t tlen = UTF32FromUTF8(s, tbuf, 1); REQUIRE(tlen == 1U); REQUIRE(tbuf[0] == 0x10348); } @@ -220,7 +220,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, 4, tbuf, 4); + size_t tlen = UTF32FromUTF8(s, tbuf, 4); REQUIRE(tlen == 4U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); REQUIRE(tbuf[1] == 0xB5); @@ -231,7 +231,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, 2, tbuf, 2); + size_t tlen = UTF32FromUTF8(s, tbuf, 2); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); REQUIRE(tbuf[1] == 0xC2); @@ -240,7 +240,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, 4, tbuf, 4); + size_t tlen = UTF32FromUTF8(s, tbuf, 4); REQUIRE(tlen == 2U); REQUIRE(tbuf[0] == static_cast<unsigned int>('a')); REQUIRE(tbuf[1] == 0xF1); |