Date: Friday, January 19, 2007 @ 13:32:08
Author: marc
Path: /cvsroot/carob/carob/test/01-Unit
Modified: TestStringCodecs.cpp (1.9 -> 1.10) TestStringCodecs.hpp (1.4 ->
1.5)
Splitted UTF8codec() test method into localeUTF8codec() and iconvUTF8codec().
CAROB-79
----------------------+
TestStringCodecs.cpp | 33 ++++++++++++++++++++++++---------
TestStringCodecs.hpp | 6 +++++-
2 files changed, 29 insertions(+), 10 deletions(-)
Index: carob/test/01-Unit/TestStringCodecs.cpp
diff -u carob/test/01-Unit/TestStringCodecs.cpp:1.9
carob/test/01-Unit/TestStringCodecs.cpp:1.10
--- carob/test/01-Unit/TestStringCodecs.cpp:1.9 Thu Jan 18 16:48:54 2007
+++ carob/test/01-Unit/TestStringCodecs.cpp Fri Jan 19 13:32:08 2007
@@ -69,15 +69,10 @@
wstring wide_cae(wide_cae_, 5);
}
-void TestStringCodecs::UTF8codec()
+namespace {
+void do_testUTF8codec(const StringCodec& utf8_codec)
{
-#ifdef CAROB_USE_ICONV
- IconvCodec utf8_codec("UTF-8");
-#else
- MBSCodec utf8_codec(tryUTF8locale());
-#endif
-
char utf8_pbk_[] = { 0xcf, 0x86, 0xce, 0xb2, 0xce, 0xba, 0, 0xce, 0xba };
string utf8_pbk(utf8_pbk_, 9);
@@ -93,7 +88,21 @@
CPPUNIT_ASSERT(0 == wide_cae.compare(utf8_codec.decode(utf8s)));
}
+}
+
+void TestStringCodecs::localeUTF8codec()
+{
+ MBSCodec utf8_codec(tryUTF8locale());
+ do_testUTF8codec(utf8_codec);
+}
+#ifdef CAROB_USE_ICONV
+void TestStringCodecs::iconvUTF8codec()
+{
+ IconvCodec utf8_codec(("UTF-8"));
+ do_testUTF8codec(utf8_codec);
+}
+#endif
void TestStringCodecs::encode_decode()
{
@@ -178,8 +187,14 @@
"TestStringCodecs::encode_decode",
&TestStringCodecs::encode_decode));
suiteOfTests->addTest(new CppUnit::TestCaller<TestStringCodecs>(
- "TestStringCodecs::UTF8codec",
- &TestStringCodecs::UTF8codec));
+ "TestStringCodecs::localeUTF8codec",
+ &TestStringCodecs::localeUTF8codec));
+#ifdef CAROB_USE_ICONV
+ suiteOfTests->addTest(new CppUnit::TestCaller<TestStringCodecs>(
+ "TestStringCodecs::iconvUTF8codec",
+ &TestStringCodecs::iconvUTF8codec));
+#endif
+
return suiteOfTests;
}
Index: carob/test/01-Unit/TestStringCodecs.hpp
diff -u carob/test/01-Unit/TestStringCodecs.hpp:1.4
carob/test/01-Unit/TestStringCodecs.hpp:1.5
--- carob/test/01-Unit/TestStringCodecs.hpp:1.4 Thu Jan 18 16:48:54 2007
+++ carob/test/01-Unit/TestStringCodecs.hpp Fri Jan 19 13:32:08 2007
@@ -33,7 +33,11 @@
/** Suite of tests to be run */
static CppUnit::Test* suite();
- void UTF8codec();
+ void localeUTF8codec();
+#ifdef CAROB_USE_ICONV
+ void iconvUTF8codec();
+#endif
+
/**
* Encode various strings in different locales and checks that decoding
* returns the same string
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits