Index: runtime/vm/unicode_test.cc |
diff --git a/runtime/vm/unicode_test.cc b/runtime/vm/unicode_test.cc |
index 582a2a6f507095612468224483005b3f83345cec..967e9caaccb8b4ca6edfb8f51b725537f365a880 100644 |
--- a/runtime/vm/unicode_test.cc |
+++ b/runtime/vm/unicode_test.cc |
@@ -12,8 +12,8 @@ TEST_CASE(Utf8Decode) { |
// Examples from the Unicode specification, chapter 3 |
{ |
const char* src = "\x41\xC3\xB1\x42"; |
- int32_t expected[] = { 0x41, 0xF1, 0x42 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x41, 0xF1, 0x42 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -22,8 +22,8 @@ TEST_CASE(Utf8Decode) { |
{ |
const char* src = "\x4D"; |
- int32_t expected[] = { 0x4D }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x4D }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -32,8 +32,8 @@ TEST_CASE(Utf8Decode) { |
{ |
const char* src = "\xD0\xB0"; |
- int32_t expected[] = { 0x430 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x430 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -42,8 +42,8 @@ TEST_CASE(Utf8Decode) { |
{ |
const char* src = "\xE4\xBA\x8C"; |
- int32_t expected[] = { 0x4E8C }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x4E8C }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -52,8 +52,8 @@ TEST_CASE(Utf8Decode) { |
{ |
const char* src = "\xF0\x90\x8C\x82"; |
- int32_t expected[] = { 0x10302 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x10302 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -62,8 +62,8 @@ TEST_CASE(Utf8Decode) { |
{ |
const char* src = "\x4D\xD0\xB0\xE4\xBA\x8C\xF0\x90\x8C\x82"; |
- int32_t expected[] = { 0x4D, 0x430, 0x4E8C, 0x10302 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x4D, 0x430, 0x4E8C, 0x10302 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -75,10 +75,10 @@ TEST_CASE(Utf8Decode) { |
const char* src = "\xD7\x92\xD7\x9C\xD7\xA2\xD7\x93" |
"\x20" |
"\xD7\x91\xD7\xA8\xD7\x9B\xD7\x94"; |
- int32_t expected[] = { 0x5D2, 0x5DC, 0x5E2, 0x5D3, |
- 0x20, |
- 0x5D1, 0x5E8, 0x5DB, 0x5D4 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x5D2, 0x5DC, 0x5E2, 0x5D3, |
+ 0x20, |
+ 0x5D1, 0x5E8, 0x5DB, 0x5D4 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -90,8 +90,8 @@ TEST_CASE(Utf8Decode) { |
// 1 - Some correct UTF-8 text |
{ |
const char* src = "\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5"; |
- int32_t expected[] = { 0x3BA, 0x1F79, 0x3C3, 0x3BC, 0x3B5 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x3BA, 0x1F79, 0x3C3, 0x3BC, 0x3B5 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -105,8 +105,8 @@ TEST_CASE(Utf8Decode) { |
// 2.1.1 - 1 byte (U-00000000): "\x00" |
{ |
const char* src = "\x00"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -116,8 +116,8 @@ TEST_CASE(Utf8Decode) { |
// 2.1.2 - 2 bytes (U-00000080): "\xC2\x80" |
{ |
const char* src = "\xC2\x80"; |
- int32_t expected[] = { 0x80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -127,8 +127,8 @@ TEST_CASE(Utf8Decode) { |
// 2.1.3 - 3 bytes (U-00000800): "\xE0\xA0\x80" |
{ |
const char* src = "\xE0\xA0\x80"; |
- int32_t expected[] = { 0x800 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x800 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -138,8 +138,8 @@ TEST_CASE(Utf8Decode) { |
// 2.1.4 - 4 bytes (U-00010000): "\xF0\x90\x80\x80" |
{ |
const char* src = "\xF0\x90\x80\x80"; |
- int32_t expected[] = { 0x10000 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x10000 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -149,8 +149,8 @@ TEST_CASE(Utf8Decode) { |
// 2.1.5 - 5 bytes (U-00200000): "\xF8\x88\x80\x80\x80" |
{ |
const char* src = "\xF8\x88\x80\x80\x80"; |
- int32_t expected[] = { 0x200000 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x200000 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -160,8 +160,8 @@ TEST_CASE(Utf8Decode) { |
// 2.1.6 - 6 bytes (U-04000000): "\xFC\x84\x80\x80\x80\x80" |
{ |
const char* src = "\xFC\x84\x80\x80\x80\x80"; |
- int32_t expected[] = { 0x400000 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x400000 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -173,8 +173,8 @@ TEST_CASE(Utf8Decode) { |
// 2.2.1 - 1 byte (U-0000007F): "\x7F" |
{ |
const char* src = "\x7F"; |
- int32_t expected[] = { 0x7F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x7F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -184,8 +184,8 @@ TEST_CASE(Utf8Decode) { |
// 2.2.2 - 2 bytes (U-000007FF): "\xDF\xBF" |
{ |
const char* src = "\xDF\xBF"; |
- int32_t expected[] = { 0x7FF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x7FF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -195,8 +195,8 @@ TEST_CASE(Utf8Decode) { |
// 2.2.3 - 3 bytes (U-0000FFFF): "\xEF\xBF\xBF" |
{ |
const char* src = "\xEF\xBF\xBF"; |
- int32_t expected[] = { 0xFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -206,8 +206,8 @@ TEST_CASE(Utf8Decode) { |
// 2.2.4 - 4 bytes (U-001FFFFF): "\xF7\xBF\xBF\xBF" |
{ |
const char* src = "\xF7\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x1FFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x1FFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -217,8 +217,8 @@ TEST_CASE(Utf8Decode) { |
// 2.2.5 - 5 bytes (U-03FFFFFF): "\xFB\xBF\xBF\xBF\xBF" |
{ |
const char* src = "\xFB\xBF\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x3FFFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x3FFFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -228,8 +228,8 @@ TEST_CASE(Utf8Decode) { |
// 2.2.6 - 6 bytes (U-7FFFFFFF): "\xFD\xBF\xBF\xBF\xBF\xBF" |
{ |
const char* src = "\xFD\xBF\xBF\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x7FFFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x7FFFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -241,8 +241,8 @@ TEST_CASE(Utf8Decode) { |
// 2.3.1 - U-0000D7FF = ed 9f bf = "\xED\x9F\xBF" |
{ |
const char* src = "\xED\x9F\xBF"; |
- int32_t expected[] = { 0xD7FF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xD7FF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -252,8 +252,8 @@ TEST_CASE(Utf8Decode) { |
// 2.3.2 - U-0000E000 = ee 80 80 = "\xEE\x80\x80" |
{ |
const char* src = "\xEE\x80\x80"; |
- int32_t expected[] = { 0xE000 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xE000 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -263,8 +263,8 @@ TEST_CASE(Utf8Decode) { |
// 2.3.3 - U-0000FFFD = ef bf bd = "\xEF\xBF\xBD" |
{ |
const char* src = "\xEF\xBF\xBD"; |
- int32_t expected[] = { 0xFFFD }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFFFD }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -274,8 +274,8 @@ TEST_CASE(Utf8Decode) { |
// 2.3.4 - U-0010FFFF = f4 8f bf bf = "\xF4\x8F\xBF\xBF" |
{ |
const char* src = "\xF4\x8F\xBF\xBF"; |
- int32_t expected[] = { 0x10FFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x10FFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -285,8 +285,8 @@ TEST_CASE(Utf8Decode) { |
// 2.3.5 - U-00110000 = f4 90 80 80 = "\xF4\x90\x80\x80" |
{ |
const char* src = "\xF4\x90\x80\x80"; |
- int32_t expected[] = { 0x110000 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x110000 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -300,8 +300,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.1 - First continuation byte 0x80: "\x80" |
{ |
const char* src = "\x80"; |
- int32_t expected[] = { 0x80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -311,8 +311,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.2 - Last continuation byte 0xbf: "\xBF" |
{ |
const char* src = "\xBF"; |
- int32_t expected[] = { 0xBF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xBF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -322,8 +322,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.3 - 2 continuation bytes: "\x80\xBF" |
{ |
const char* src = "\x80\xBF"; |
- int32_t expected[] = { 0x80, 0xBF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80, 0xBF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -333,8 +333,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.4 - 3 continuation bytes: "\x80\xBF\x80" |
{ |
const char* src = "\x80\xBF\x80"; |
- int32_t expected[] = { 0x80, 0xBF, 0x80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80, 0xBF, 0x80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -344,8 +344,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.5 - 4 continuation bytes: "\x80\xBF\x80\xBF" |
{ |
const char* src = "\x80\xBF\x80\xBF"; |
- int32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -355,8 +355,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.6 - 5 continuation bytes: "\x80\xBF\x80\xBF\x80" |
{ |
const char* src = "\x80\xBF\x80\xBF\x80"; |
- int32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -366,8 +366,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.7 - 6 continuation bytes: "\x80\xBF\x80\xBF\x80\xBF" |
{ |
const char* src = "\x80\xBF\x80\xBF\x80\xBF"; |
- int32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -377,8 +377,8 @@ TEST_CASE(Utf8Decode) { |
// 3.1.8 - 7 continuation bytes: "\x80\xBF\x80\xBF\x80\xBF\x80" |
{ |
const char* src = "\x80\xBF\x80\xBF\x80\xBF\x80"; |
- int32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -395,8 +395,8 @@ TEST_CASE(Utf8Decode) { |
"\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" |
"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" |
"\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); ++i) { |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst)); |
@@ -418,8 +418,8 @@ TEST_CASE(Utf8Decode) { |
"\xD4\x20\xD5\x20\xD6\x20\xD7\x20" |
"\xD8\x20\xD9\x20\xDA\x20\xDB\x20" |
"\xDC\x20\xDD\x20\xDE\x20\xDF\x20"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); i += 2) { |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst)); |
@@ -435,8 +435,8 @@ TEST_CASE(Utf8Decode) { |
"\xE4\x20\xE5\x20\xE6\x20\xE7\x20" |
"\xE8\x20\xE9\x20\xEA\x20\xEB\x20" |
"\xEC\x20\xED\x20\xEE\x20\xEF\x20"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); i += 2) { |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst)); |
@@ -450,8 +450,8 @@ TEST_CASE(Utf8Decode) { |
{ |
const char* src = "\xF0\x20\xF1\x20\xF2\x20\xF3\x20" |
"\xF4\x20\xF5\x20\xF6\x20\xF7\x20"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); i += 2) { |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst)); |
@@ -464,8 +464,8 @@ TEST_CASE(Utf8Decode) { |
// followed by a space character: |
{ |
const char* src = "\xF8\x20\xF9\x20\xFA\x20\xFB\x20"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); i += 2) { |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst)); |
@@ -478,8 +478,8 @@ TEST_CASE(Utf8Decode) { |
// followed by a space character: |
{ |
const char* src = "\xFC\x20\xFD\x20"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); i += 2) { |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst)); |
@@ -493,8 +493,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.1 - 2-byte sequence with last byte missing (U+0000): "\xC0" |
{ |
const char* src = "\xC0"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -504,8 +504,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.2 - 3-byte sequence with last byte missing (U+0000): "\xE0\x80" |
{ |
const char* src = "\xE0\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -515,8 +515,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.3 - 4-byte sequence with last byte missing (U+0000): "\xF0\x80\x80" |
{ |
const char* src = "\xF0\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -526,8 +526,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.4 - 5-byte sequence with last byte missing (U+0000): "\xF8\x80\x80\x80" |
{ |
const char* src = "\xF8\x80\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -538,8 +538,8 @@ TEST_CASE(Utf8Decode) { |
// "\xFC\x80\x80\x80\x80" |
{ |
const char* src = "\xFC\x80\x80\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -549,8 +549,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.6 - 2-byte sequence with last byte missing (U-000007FF): "\xDF" |
{ |
const char* src = "\xDF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -560,8 +560,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.7 - 3-byte sequence with last byte missing (U-0000FFFF): "\xEF\xBF" |
{ |
const char* src = "\xEF\xBF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -571,8 +571,8 @@ TEST_CASE(Utf8Decode) { |
// 3.3.8 - 4-byte sequence with last byte missing (U-001FFFFF): "\xF7\xBF\xBF" |
{ |
const char* src = "\xF7\xBF\xBF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -583,8 +583,8 @@ TEST_CASE(Utf8Decode) { |
// "\xFB\xBF\xBF\xBF" |
{ |
const char* src = "\xFB\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -595,8 +595,8 @@ TEST_CASE(Utf8Decode) { |
// "\xFD\xBF\xBF\xBF\xBF" |
{ |
const char* src = "\xFD\xBF\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -610,8 +610,8 @@ TEST_CASE(Utf8Decode) { |
"\x80\x80\x80\xDF\xEF\xBF" |
"\xF7\xBF\xBF\xFB\xBF\xBF" |
"\xBF\xFD\xBF\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
for (size_t i = 0; i < strlen(src); ++i) { |
for (size_t j = 1; j < (strlen(src) - i); ++j) { |
memset(dst, 0xFF, sizeof(dst)); |
@@ -628,8 +628,8 @@ TEST_CASE(Utf8Decode) { |
// 3.5.1 - fe = "\xFE" |
{ |
const char* src = "\xFE"; |
- int32_t expected[] = { 0xFE }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFE }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -639,8 +639,8 @@ TEST_CASE(Utf8Decode) { |
// 3.5.2 - ff = "\xFF" |
{ |
const char* src = "\xFF"; |
- int32_t expected[] = { 0xFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -650,8 +650,8 @@ TEST_CASE(Utf8Decode) { |
// 3.5.3 - fe fe ff ff = "\xFE\xFE\xFF\xFF" |
{ |
const char* src = "\xFE\xFE\xFF\xFF"; |
- int32_t expected[] = { 0xFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -665,8 +665,8 @@ TEST_CASE(Utf8Decode) { |
// 4.1.1 - U+002F = c0 af = "\xC0\xAF" |
{ |
const char* src = "\xC0\xAF"; |
- int32_t expected[] = { 0x2F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x2F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -676,8 +676,8 @@ TEST_CASE(Utf8Decode) { |
// 4.1.2 - U+002F = e0 80 af = "\xE0\x80\xAF" |
{ |
const char* src = "\xE0\x80\xAF"; |
- int32_t expected[] = { 0x2F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x2F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -687,8 +687,8 @@ TEST_CASE(Utf8Decode) { |
// 4.1.3 - U+002F = f0 80 80 af = "\xF0\x80\x80\xAF" |
{ |
const char* src = "\xF0\x80\x80\xAF"; |
- int32_t expected[] = { 0x2F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x2F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -698,8 +698,8 @@ TEST_CASE(Utf8Decode) { |
// 4.1.4 - U+002F = f8 80 80 80 af = "\xF8\x80\x80\x80\xAF" |
{ |
const char* src = "\xF8\x80\x80\x80\xAF"; |
- int32_t expected[] = { 0x2F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x2F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -709,8 +709,8 @@ TEST_CASE(Utf8Decode) { |
// 4.1.5 - U+002F = fc 80 80 80 80 af = "\xFC\x80\x80\x80\x80\xAF" |
{ |
const char* src = "\xFC\x80\x80\x80\x80\xAF"; |
- int32_t expected[] = { 0x2F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x2F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -722,8 +722,8 @@ TEST_CASE(Utf8Decode) { |
// 4.2.1 - U-0000007F = c1 bf = "\xC1\xBF" |
{ |
const char* src = "\xC1\xBF"; |
- int32_t expected[] = { 0x7F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x7F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -733,8 +733,8 @@ TEST_CASE(Utf8Decode) { |
// 4.2.2 U+000007FF = e0 9f bf = "\xE0\x9F\xBF" |
{ |
const char* src = "\xE0\x9F\xBF"; |
- int32_t expected[] = { 0x7FF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x7FF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -744,8 +744,8 @@ TEST_CASE(Utf8Decode) { |
// 4.2.3 - U+0000FFFF = f0 8f bf bf = "\xF0\x8F\xBF\xBF" |
{ |
const char* src = "\xF0\x8F\xBF\xBF"; |
- int32_t expected[] = { 0xFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -755,8 +755,8 @@ TEST_CASE(Utf8Decode) { |
// 4.2.4 U-001FFFFF = f8 87 bf bf bf = "\xF8\x87\xBF\xBF\xBF" |
{ |
const char* src = "\xF8\x87\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x1FFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x1FFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -766,8 +766,8 @@ TEST_CASE(Utf8Decode) { |
// 4.2.5 U-03FFFFFF = fc 83 bf bf bf bf = "\xFC\x83\xBF\xBF\xBF\xBF" |
{ |
const char* src = "\xFC\x83\xBF\xBF\xBF\xBF"; |
- int32_t expected[] = { 0x3FFFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x3FFFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -779,8 +779,8 @@ TEST_CASE(Utf8Decode) { |
// 4.3.1 - U+0000 = "\xC0\x80" |
{ |
const char* src = "\xC0\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -790,8 +790,8 @@ TEST_CASE(Utf8Decode) { |
// 4.3.2 U+0000 = e0 80 80 = "\xE0\x80\x80" |
{ |
const char* src = "\xE0\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -801,8 +801,8 @@ TEST_CASE(Utf8Decode) { |
// 4.3.3 U+0000 = f0 80 80 80 = "\xF0\x80\x80\x80" |
{ |
const char* src = "\xF0\x80\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -812,8 +812,8 @@ TEST_CASE(Utf8Decode) { |
// 4.3.4 U+0000 = f8 80 80 80 80 = "\xF8\x80\x80\x80\x80" |
{ |
const char* src = "\xF8\x80\x80\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -823,8 +823,8 @@ TEST_CASE(Utf8Decode) { |
// 4.3.5 U+0000 = fc 80 80 80 80 80 = "\xFC\x80\x80\x80\x80\x80" |
{ |
const char* src = "\xFC\x80\x80\x80\x80\x80"; |
- int32_t expected[] = { 0x0 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0x0 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0xFF, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -836,8 +836,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.1 - U+D800 = ed a0 80 = "\xED\xA0\x80" |
{ |
const char* src = "\xED\xA0\x80"; |
- int32_t expected[] = { 0xD800 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xD800 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -847,8 +847,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.2 - U+DB7F = ed ad bf = "\xED\xAD\xBF" |
{ |
const char* src = "\xED\xAD\xBF"; |
- int32_t expected[] = { 0xDB7F }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDB7F }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -858,8 +858,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.3 - U+DB80 = ed ae 80 = "\xED\xAE\x80" |
{ |
const char* src = "\xED\xAE\x80"; |
- int32_t expected[] = { 0xDB80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDB80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -869,8 +869,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.4 - U+DBFF = ed af bf = "\xED\xAF\xBF" |
{ |
const char* src = "\xED\xAF\xBF"; |
- int32_t expected[] = { 0xDBFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDBFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -880,8 +880,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.5 - U+DC00 = ed b0 80 = "\xED\xB0\x80" |
{ |
const char* src = "\xED\xB0\x80"; |
- int32_t expected[] = { 0xDC00 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDC00 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -891,8 +891,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.6 - U+DF80 = ed be 80 = "\xED\xBE\x80" |
{ |
const char* src = "\xED\xBE\x80"; |
- int32_t expected[] = { 0xDF80 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDF80 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -902,8 +902,8 @@ TEST_CASE(Utf8Decode) { |
// 5.1.7 - U+DFFF = ed bf bf = "\xED\xBF\xBF" |
{ |
const char* src = "\xED\xBF\xBF"; |
- int32_t expected[] = { 0xDFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -915,8 +915,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.1 - U+D800 U+DC00 = ed a0 80 ed b0 80 = "\xED\xA0\x80\xED\xB0\x80" |
{ |
const char* src = "\xED\xA0\x80\xED\xB0\x80"; |
- int32_t expected[] = { 0xD800, 0xDC00 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xD800, 0xDC00 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -926,8 +926,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.2 - U+D800 U+DFFF = ed a0 80 ed bf bf = "\xED\xA0\x80\xED\xBF\xBF" |
{ |
const char* src = "\xED\xA0\x80\xED\xBF\xBF"; |
- int32_t expected[] = { 0xD800, 0xDFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xD800, 0xDFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -937,8 +937,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.3 - U+DB7F U+DC00 = ed a0 80 ed bf bf = "\xED\xAD\xBF\xED\xB0\x80" |
{ |
const char* src = "\xED\xAD\xBF\xED\xB0\x80"; |
- int32_t expected[] = { 0xDB7F, 0xDC00 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDB7F, 0xDC00 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -948,8 +948,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.4 - U+DB7F U+DFFF = ed ad bf ed bf bf = "\xED\xAD\xBF\xED\xBF\xBF" |
{ |
const char* src = "\xED\xAD\xBF\xED\xBF\xBF"; |
- int32_t expected[] = { 0xDB7F, 0xDFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDB7F, 0xDFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -959,8 +959,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.5 - U+DB80 U+DC00 = ed ae 80 ed b0 80 = "\xED\xAE\x80\xED\xB0\x80" |
{ |
const char* src = "\xED\xAE\x80\xED\xB0\x80"; |
- int32_t expected[] = { 0xDB80, 0xDC00 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDB80, 0xDC00 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -970,8 +970,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.6 - U+DB80 U+DFFF = ed ae 80 ed bf bf = "\xED\xAE\x80\xED\xBF\xBF" |
{ |
const char* src = "\xED\xAE\x80\xED\xBF\xBF"; |
- int32_t expected[] = { 0xDB80, 0xDFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDB80, 0xDFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -981,8 +981,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.7 - U+DBFF U+DC00 = ed af bf ed b0 80 = "\xED\xAF\xBF\xED\xB0\x80" |
{ |
const char* src = "\xED\xAF\xBF\xED\xB0\x80"; |
- int32_t expected[] = { 0xDBFF, 0xDC00 }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDBFF, 0xDC00 }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -992,8 +992,8 @@ TEST_CASE(Utf8Decode) { |
// 5.2.8 - U+DBFF U+DFFF = ed af bf ed bf bf = "\xED\xAF\xBF\xED\xBF\xBF" |
{ |
const char* src = "\xED\xAF\xBF\xED\xBF\xBF"; |
- int32_t expected[] = { 0xDBFF, 0xDFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xDBFF, 0xDFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(!is_valid); |
@@ -1005,8 +1005,8 @@ TEST_CASE(Utf8Decode) { |
// 5.3.1 - U+FFFE = ef bf be = "\xEF\xBF\xBE" |
{ |
const char* src = "\xEF\xBF\xBE"; |
- int32_t expected[] = { 0xFFFE }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFFFE }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |
@@ -1016,8 +1016,8 @@ TEST_CASE(Utf8Decode) { |
// 5.3.2 - U+FFFF = ef bf bf = "\xEF\xBF\xBF" |
{ |
const char* src = "\xEF\xBF\xBF"; |
- int32_t expected[] = { 0xFFFF }; |
- int32_t dst[ARRAY_SIZE(expected)]; |
+ uint32_t expected[] = { 0xFFFF }; |
+ uint32_t dst[ARRAY_SIZE(expected)]; |
memset(dst, 0, sizeof(dst)); |
bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst)); |
EXPECT(is_valid); |