summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/unicode/Client.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-06-03 14:47:10 -0400
committerBernard Normier <bernard@zeroc.com>2016-06-03 14:47:10 -0400
commitd18c04f3666ac2c710a1221092166b095b5d2b0d (patch)
tree6b146dc454f30a52fbf03e1fd4560c8360da46f9 /cpp/test/IceUtil/unicode/Client.cpp
parentImproved unicode test (diff)
downloadice-d18c04f3666ac2c710a1221092166b095b5d2b0d.tar.bz2
ice-d18c04f3666ac2c710a1221092166b095b5d2b0d.tar.xz
ice-d18c04f3666ac2c710a1221092166b095b5d2b0d.zip
More UTF tests
Diffstat (limited to 'cpp/test/IceUtil/unicode/Client.cpp')
-rw-r--r--cpp/test/IceUtil/unicode/Client.cpp19
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;
}