diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-06-03 14:47:10 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-06-03 14:47:10 -0400 |
commit | d18c04f3666ac2c710a1221092166b095b5d2b0d (patch) | |
tree | 6b146dc454f30a52fbf03e1fd4560c8360da46f9 | |
parent | Improved unicode test (diff) | |
download | ice-d18c04f3666ac2c710a1221092166b095b5d2b0d.tar.bz2 ice-d18c04f3666ac2c710a1221092166b095b5d2b0d.tar.xz ice-d18c04f3666ac2c710a1221092166b095b5d2b0d.zip |
More UTF tests
-rw-r--r-- | cpp/test/IceUtil/unicode/Client.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp index a10bbea2e74..b3d3912057b 100644 --- a/cpp/test/IceUtil/unicode/Client.cpp +++ b/cpp/test/IceUtil/unicode/Client.cpp @@ -210,6 +210,25 @@ main(int argc, char* argv[]) test(ns == good); test(ws == IceUtil::stringToWstring(ns)); + vector<Byte> u8 = vector<Byte>(reinterpret_cast<const Byte*>(ns.data()), + reinterpret_cast<const Byte*>(ns.data() + ns.length())); + + vector<unsigned short> u16 = IceUtilInternal::toUTF16(u8); + test(u16.size() == 4); + test(u16[0] == 0x20ac); + test(u16[1] == 0x20ac); + test(u16[2] == 0xd801); + test(u16[3] == 0xdc37); + + vector<unsigned int> u32 = IceUtilInternal::toUTF32(u8); + test(u32.size() == 3); + test(u32[0] == 0x20ac); + test(u32[1] == 0x20ac); + test(u32[2] == 0x10437); + + vector<Byte> nu8 = IceUtilInternal::fromUTF32(u32); + test(nu8 == u8); + cout << "ok" << endl; } |