[Scummvm-git-logs] scummvm master -> c201ddfcf49eb3d850163e8dd6e8923e60c4d834
lephilousophe
lephilousophe at users.noreply.github.com
Sun Aug 8 11:56:53 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c201ddfcf4 TEST: Fix encoding test adding a '\0'
Commit: c201ddfcf49eb3d850163e8dd6e8923e60c4d834
https://github.com/scummvm/scummvm/commit/c201ddfcf49eb3d850163e8dd6e8923e60c4d834
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2021-08-08T13:56:00+02:00
Commit Message:
TEST: Fix encoding test adding a '\0'
Use sizeof at the same time to avoid hardcoded constants
Changed paths:
test/common/encoding.h
diff --git a/test/common/encoding.h b/test/common/encoding.h
index 4819d96718..210cd4ae65 100644
--- a/test/common/encoding.h
+++ b/test/common/encoding.h
@@ -259,16 +259,16 @@ public:
unsigned char iso_8859_2[] = {0xA9, 0xE1, 0x6C, 0x65, 0xE8, 0x65, 0x6B, 0};
unsigned char utf8_2[] = {0xC5, 0xA0, 0xC3, 0xA1, 0x6C, 0x65, 0xC4, 0x8D, 0x65, 0x6B, 0};
- Common::String result = Common::U32String((const char *) cp850, 5, Common::kDos850).encode(Common::kUtf8);
- TS_ASSERT_EQUALS(memcmp(result.c_str(), utf8_1, 9), 0);
+ Common::String result = Common::U32String((const char *) cp850, sizeof(cp850)-1, Common::kDos850).encode(Common::kUtf8);
+ TS_ASSERT_EQUALS(memcmp(result.c_str(), utf8_1, sizeof(utf8_1)), 0);
- result = Common::U32String((const char *) utf8_1, 8, Common::kUtf8).encode(Common::kDos850);
- TS_ASSERT_EQUALS(memcmp(result.c_str(), cp850, 6), 0);
+ result = Common::U32String((const char *) utf8_1, sizeof(utf8_1)-1, Common::kUtf8).encode(Common::kDos850);
+ TS_ASSERT_EQUALS(memcmp(result.c_str(), cp850, sizeof(cp850)), 0);
- result = Common::U32String((const char *) iso_8859_2, 7, Common::kISO8859_2).encode(Common::kUtf8);
- TS_ASSERT_EQUALS(memcmp(result.c_str(), utf8_2, 11), 0);
+ result = Common::U32String((const char *) iso_8859_2, sizeof(iso_8859_2)-1, Common::kISO8859_2).encode(Common::kUtf8);
+ TS_ASSERT_EQUALS(memcmp(result.c_str(), utf8_2, sizeof(utf8_2)), 0);
- result = Common::U32String((const char *) utf8_2, 11, Common::kUtf8).encode(Common::kISO8859_2);
- TS_ASSERT_EQUALS(memcmp(result.c_str(), iso_8859_2, 8), 0);
+ result = Common::U32String((const char *) utf8_2, sizeof(utf8_2)-1, Common::kUtf8).encode(Common::kISO8859_2);
+ TS_ASSERT_EQUALS(memcmp(result.c_str(), iso_8859_2, sizeof(iso_8859_2)), 0);
}
};
More information about the Scummvm-git-logs
mailing list