aboutsummaryrefslogtreecommitdiffhomepage
path: root/unittest
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-12-30 23:47:22 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-12-30 23:47:49 -0800
commit397924a9103d44a21fb61fe6c275e11551a285f2 (patch)
treee85b239ac77253fd38f047731241bff77b9310d3 /unittest
parentd6c9c93b1f14b4733929a3ba44668c9696ed91ab (diff)
Added unit test for MUTF-7
Diffstat (limited to 'unittest')
-rw-r--r--unittest/unittest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/unittest/unittest.cpp b/unittest/unittest.cpp
index cdf02a2c..f2368810 100644
--- a/unittest/unittest.cpp
+++ b/unittest/unittest.cpp
@@ -311,6 +311,28 @@ static void testSummary(String * path)
global_success ++;
}
+static void testMUTF7(void)
+{
+ int failure = 0;
+ int success = 0;
+ const char * mutf7string = "~peter/mail/&U,BTFw-/&ZeVnLIqe-";
+ IMAPNamespace * ns = IMAPNamespace::namespaceWithPrefix(MCSTR(""), '/');
+ Array * result = ns->componentsFromPath(String::stringWithUTF8Characters(mutf7string));
+ if (strcmp(MCUTF8(result), "[~peter,mail,台北,日本語]") != 0) {
+ failure ++;
+ }
+ else {
+ success ++;
+ }
+ if (failure > 0) {
+ printf("testMUTF7 ok: %i succeeded, %i failed\n", success, failure);
+ global_failure ++;
+ return;
+ }
+ printf("testMUTF7 ok: %i succeeded\n", success);
+ global_success ++;
+}
+
int main(int argc, char ** argv)
{
tzset();
@@ -332,6 +354,7 @@ int main(int argc, char ** argv)
testMessageParser(path->stringByAppendingPathComponent(MCSTR("parser")));
testCharsetDetection(path->stringByAppendingPathComponent(MCSTR("charset-detection")));
testSummary(path->stringByAppendingPathComponent(MCSTR("summary")));
+ testMUTF7();
printf("%i tests succeeded, %i tests failed\n", global_success, global_failure);