summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/unicode/Client.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-01-17 20:44:43 +0000
committerMarc Laukien <marc@zeroc.com>2002-01-17 20:44:43 +0000
commit1f1cf73acd69c71de92bd3ee8349eb6e4fc76823 (patch)
tree0abb119b376a4f1b726688c842036ec9f7f28ffc /cpp/test/IceUtil/unicode/Client.cpp
parentinterop fix (diff)
downloadice-1f1cf73acd69c71de92bd3ee8349eb6e4fc76823.tar.bz2
ice-1f1cf73acd69c71de92bd3ee8349eb6e4fc76823.tar.xz
ice-1f1cf73acd69c71de92bd3ee8349eb6e4fc76823.zip
unicode test suite extensions
Diffstat (limited to 'cpp/test/IceUtil/unicode/Client.cpp')
-rw-r--r--cpp/test/IceUtil/unicode/Client.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp
index 2d978284191..b060f6935e7 100644
--- a/cpp/test/IceUtil/unicode/Client.cpp
+++ b/cpp/test/IceUtil/unicode/Client.cpp
@@ -10,6 +10,7 @@
#include <IceUtil/Unicode.h>
#include <TestCommon.h>
+#include <fstream>
using namespace IceUtil;
using namespace std;
@@ -39,5 +40,64 @@ main(int, char**)
cout << "ok" << endl;
+ cout << "ditto, but with random utf-8 data... ";
+
+ ifstream numeric("numeric.txt");
+ test(numeric.good());
+ wstring wrandom;
+ while (numeric)
+ {
+ int c;
+ numeric >> c;
+ if (numeric)
+ {
+ wrandom += static_cast<wchar_t>(c);
+ }
+ }
+ numeric.close();
+
+ ifstream utf8("utf8.txt");
+ test(utf8.good());
+ string random;
+ while (utf8)
+ {
+ char c;
+ utf8.get(c);
+ if (utf8)
+ {
+ random += c;
+ }
+ }
+ utf8.close();
+
+ string random2 = wstringToString(wrandom);
+ wstring wrandom2 = stringToWstring(random);
+
+/*
+ unsigned int i;
+
+ ofstream numeric2("numeric2.txt");
+ for (i = 0; i < wrandom2.length(); ++i)
+ {
+ numeric2 << static_cast<int>(wrandom2[i]) << '\n';
+ }
+ numeric2.close();
+
+ ofstream utf82("utf82.txt");
+ for (i = 0; i < random2.length(); ++i)
+ {
+ utf82.put(random2[i]);
+ }
+ utf82.close();
+*/
+
+ test (random2.length() == random.length());
+ test (wrandom2.length() == wrandom.length());
+
+ test (random2 == random);
+ test (wrandom2 == wrandom);
+
+ cout << "ok" << endl;
+
return EXIT_SUCCESS;
}