]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/utransts.c
ICU-491.11.3.tar.gz
[apple/icu.git] / icuSources / test / cintltst / utransts.c
index b472fe16a62a31b070e90425aea9ced011a04241..440b915e819e7e64f9e1e2a17f8d84f4a4713486 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *******************************************************************************
- *   Copyright (C) 1997-2004, International Business Machines
+ *   Copyright (C) 1997-2009, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *******************************************************************************
  *   Date        Name        Description
@@ -271,7 +271,7 @@ static void TestOpenInverse(){
         status = U_ZERO_ERROR;
         t1=utrans_open(TransID[i], UTRANS_FORWARD,NULL,0,NULL, &status);
         if(t1 == NULL || U_FAILURE(status)){
-            log_err("FAIL: in instantiation for id=%s\n", TransID[i]);
+            log_data_err("FAIL: in instantiation for id=%s -> %s (Are you missing data?)\n", TransID[i], u_errorName(status));
             continue;
         }
         inverse1=utrans_openInverse(t1, &status);
@@ -299,7 +299,7 @@ static void TestClone(){
    
     t1=utrans_open("Latin-Devanagari", UTRANS_FORWARD, NULL,0,NULL,&status);
     if(U_FAILURE(status)){
-        log_err("FAIL: construction\n");
+        log_data_err("FAIL: construction -> %s (Are you missing data?)\n", u_errorName(status));
         return;
     }
     t2=utrans_open("Latin-Greek", UTRANS_FORWARD, NULL,0,NULL,&status);
@@ -474,6 +474,13 @@ static void TestSimpleRules() {
                  "$lu > '*';"
                  "a > ERROR",
                  "abcdefgABCDEFGU", "&bcd&fg!^**!^*&");
+
+    /* Test multiple passes 
+    */ 
+    _expectRules("abc > xy;"
+                 "::Null;"
+                 "aba > z;",
+                 "abc ababc aba", "xy abxy z"); 
 }
 
 static void TestFilter() {
@@ -578,7 +585,7 @@ static void _expectRules(const char* crules,
                              &parseErr, &status);
     if (U_FAILURE(status)) {
         utrans_close(trans);
-        log_err("FAIL: utrans_openRules(%s) failed, error=%s\n",
+        log_data_err("FAIL: utrans_openRules(%s) failed, error=%s (Are you missing data?)\n",
                 crules, u_errorName(status));
         return;
     }
@@ -605,6 +612,7 @@ static void _expect(const UTransliterator* trans,
     int32_t limit;
     UTransPosition pos;
     XReplaceable xrep;
+    XReplaceable *xrepPtr = &xrep;
     UReplaceableCallbacks xrepVtable;
 
     u_uastrcpy(from, cfrom);
@@ -659,7 +667,7 @@ static void _expect(const UTransliterator* trans,
     InitXReplaceableCallbacks(&xrepVtable);
     InitXReplaceable(&xrep, cfrom);
     limit = u_strlen(from);
-    utrans_trans(trans, (UReplaceable*)&xrep, &xrepVtable, 0, &limit, &status);
+    utrans_trans(trans, (UReplaceable*)xrepPtr, &xrepVtable, 0, &limit, &status);
     if (U_FAILURE(status)) {
         log_err("FAIL: utrans_trans() failed, error=%s\n",
                 u_errorName(status));
@@ -682,8 +690,8 @@ static void _expect(const UTransliterator* trans,
     InitXReplaceable(&xrep, cfrom);
     pos.start = pos.contextStart = 0;
     pos.limit = pos.contextLimit = u_strlen(from);
-    utrans_transIncremental(trans, (UReplaceable*)&xrep, &xrepVtable, &pos, &status);
-    utrans_trans(trans, (UReplaceable*)&xrep, &xrepVtable, pos.start, &pos.limit, &status);
+    utrans_transIncremental(trans, (UReplaceable*)xrepPtr, &xrepVtable, &pos, &status);
+    utrans_trans(trans, (UReplaceable*)xrepPtr, &xrepVtable, pos.start, &pos.limit, &status);
     if (U_FAILURE(status)) {
         log_err("FAIL: utrans_transIncremental() failed, error=%s\n",
                 u_errorName(status));