2000-06-27 16:27:02 +00:00
|
|
|
/*
|
2004-10-29 23:57:08 +00:00
|
|
|
*******************************************************************************
|
2014-01-13 07:27:02 +00:00
|
|
|
* Copyright (C) 1997-2009,2014 International Business Machines
|
2004-10-29 23:57:08 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*******************************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 06/23/00 aliu Creation.
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
2000-06-27 16:27:02 +00:00
|
|
|
|
2002-09-20 17:54:45 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_TRANSLITERATION
|
|
|
|
|
2003-04-24 16:18:05 +00:00
|
|
|
#include <stdlib.h>
|
2003-04-23 05:49:02 +00:00
|
|
|
#include <string.h>
|
2000-06-27 16:27:02 +00:00
|
|
|
#include "unicode/utrans.h"
|
|
|
|
#include "unicode/ustring.h"
|
2014-01-13 07:27:02 +00:00
|
|
|
#include "unicode/uset.h"
|
2003-04-23 05:49:02 +00:00
|
|
|
#include "cintltst.h"
|
2000-06-27 16:27:02 +00:00
|
|
|
|
|
|
|
#define TEST(x) addTest(root, &x, "utrans/" # x)
|
|
|
|
|
2001-01-31 23:07:55 +00:00
|
|
|
static void TestAPI(void);
|
|
|
|
static void TestSimpleRules(void);
|
|
|
|
static void TestFilter(void);
|
|
|
|
static void TestOpenInverse(void);
|
|
|
|
static void TestClone(void);
|
|
|
|
static void TestRegisterUnregister(void);
|
2002-02-26 17:50:59 +00:00
|
|
|
static void TestExtractBetween(void);
|
2004-09-14 17:55:43 +00:00
|
|
|
static void TestUnicodeIDs(void);
|
2014-01-13 07:27:02 +00:00
|
|
|
static void TestGetRulesAndSourceSet(void);
|
2000-06-28 23:30:05 +00:00
|
|
|
|
2000-06-27 16:27:02 +00:00
|
|
|
static void _expectRules(const char*, const char*, const char*);
|
2000-06-28 23:30:05 +00:00
|
|
|
static void _expect(const UTransliterator* trans, const char* cfrom, const char* cto);
|
2000-06-27 16:27:02 +00:00
|
|
|
|
2001-05-31 23:20:21 +00:00
|
|
|
void addUTransTest(TestNode** root);
|
|
|
|
|
|
|
|
|
2000-06-27 16:27:02 +00:00
|
|
|
void
|
|
|
|
addUTransTest(TestNode** root) {
|
|
|
|
TEST(TestAPI);
|
|
|
|
TEST(TestSimpleRules);
|
2000-06-28 23:30:05 +00:00
|
|
|
TEST(TestFilter);
|
2000-08-03 23:26:38 +00:00
|
|
|
TEST(TestOpenInverse);
|
|
|
|
TEST(TestClone);
|
|
|
|
TEST(TestRegisterUnregister);
|
2002-02-26 17:50:59 +00:00
|
|
|
TEST(TestExtractBetween);
|
2004-09-14 17:55:43 +00:00
|
|
|
TEST(TestUnicodeIDs);
|
2014-01-13 07:27:02 +00:00
|
|
|
TEST(TestGetRulesAndSourceSet);
|
2000-06-27 16:27:02 +00:00
|
|
|
}
|
|
|
|
|
2001-02-14 23:41:59 +00:00
|
|
|
/*------------------------------------------------------------------
|
|
|
|
* Replaceable glue
|
|
|
|
*
|
|
|
|
* To test the Replaceable glue we have to dummy up a C-based
|
|
|
|
* Replaceable callback. This code is for testing purposes only.
|
|
|
|
*------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
typedef struct XReplaceable {
|
|
|
|
UChar* text; /* MUST BE null-terminated */
|
|
|
|
} XReplaceable;
|
|
|
|
|
|
|
|
static void InitXReplaceable(XReplaceable* rep, const char* cstring) {
|
2003-04-23 05:49:02 +00:00
|
|
|
rep->text = malloc(sizeof(UChar) * (strlen(cstring)+1));
|
2001-02-14 23:41:59 +00:00
|
|
|
u_uastrcpy(rep->text, cstring);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void FreeXReplaceable(XReplaceable* rep) {
|
|
|
|
if (rep->text != NULL) {
|
2002-07-29 21:04:18 +00:00
|
|
|
free(rep->text);
|
2001-02-14 23:41:59 +00:00
|
|
|
rep->text = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-16 06:22:42 +00:00
|
|
|
/* UReplaceableCallbacks callback */
|
2001-02-14 23:41:59 +00:00
|
|
|
static int32_t Xlength(const UReplaceable* rep) {
|
|
|
|
const XReplaceable* x = (const XReplaceable*)rep;
|
|
|
|
return u_strlen(x->text);
|
|
|
|
}
|
|
|
|
|
2001-02-16 06:22:42 +00:00
|
|
|
/* UReplaceableCallbacks callback */
|
2001-02-14 23:41:59 +00:00
|
|
|
static UChar XcharAt(const UReplaceable* rep, int32_t offset) {
|
|
|
|
const XReplaceable* x = (const XReplaceable*)rep;
|
|
|
|
return x->text[offset];
|
|
|
|
}
|
|
|
|
|
2001-02-16 06:22:42 +00:00
|
|
|
/* UReplaceableCallbacks callback */
|
2001-02-14 23:41:59 +00:00
|
|
|
static UChar32 Xchar32At(const UReplaceable* rep, int32_t offset) {
|
|
|
|
const XReplaceable* x = (const XReplaceable*)rep;
|
|
|
|
return x->text[offset];
|
|
|
|
}
|
|
|
|
|
2001-02-16 06:22:42 +00:00
|
|
|
/* UReplaceableCallbacks callback */
|
2001-02-14 23:41:59 +00:00
|
|
|
static void Xreplace(UReplaceable* rep, int32_t start, int32_t limit,
|
|
|
|
const UChar* text, int32_t textLength) {
|
|
|
|
XReplaceable* x = (XReplaceable*)rep;
|
|
|
|
int32_t newLen = Xlength(rep) + limit - start + textLength;
|
2002-07-29 21:04:18 +00:00
|
|
|
UChar* newText = (UChar*) malloc(sizeof(UChar) * (newLen+1));
|
2001-02-14 23:41:59 +00:00
|
|
|
u_strncpy(newText, x->text, start);
|
|
|
|
u_strncpy(newText + start, text, textLength);
|
|
|
|
u_strcpy(newText + start + textLength, x->text + limit);
|
2002-07-29 21:04:18 +00:00
|
|
|
free(x->text);
|
2001-02-14 23:41:59 +00:00
|
|
|
x->text = newText;
|
|
|
|
}
|
|
|
|
|
2001-02-16 06:22:42 +00:00
|
|
|
/* UReplaceableCallbacks callback */
|
2001-02-14 23:41:59 +00:00
|
|
|
static void Xcopy(UReplaceable* rep, int32_t start, int32_t limit, int32_t dest) {
|
|
|
|
XReplaceable* x = (XReplaceable*)rep;
|
|
|
|
int32_t newLen = Xlength(rep) + limit - start;
|
2002-07-29 21:04:18 +00:00
|
|
|
UChar* newText = (UChar*) malloc(sizeof(UChar) * (newLen+1));
|
2001-02-14 23:41:59 +00:00
|
|
|
u_strncpy(newText, x->text, dest);
|
|
|
|
u_strncpy(newText + dest, x->text + start, limit - start);
|
|
|
|
u_strcpy(newText + dest + limit - start, x->text + dest);
|
2002-07-29 21:04:18 +00:00
|
|
|
free(x->text);
|
2001-02-14 23:41:59 +00:00
|
|
|
x->text = newText;
|
|
|
|
}
|
|
|
|
|
2002-02-26 17:50:59 +00:00
|
|
|
/* UReplaceableCallbacks callback */
|
|
|
|
static void Xextract(UReplaceable* rep, int32_t start, int32_t limit, UChar* dst) {
|
|
|
|
XReplaceable* x = (XReplaceable*)rep;
|
|
|
|
int32_t len = limit - start;
|
|
|
|
u_strncpy(dst, x->text, len);
|
|
|
|
}
|
|
|
|
|
2001-02-14 23:41:59 +00:00
|
|
|
static void InitXReplaceableCallbacks(UReplaceableCallbacks* callbacks) {
|
|
|
|
callbacks->length = Xlength;
|
|
|
|
callbacks->charAt = XcharAt;
|
|
|
|
callbacks->char32At = Xchar32At;
|
|
|
|
callbacks->replace = Xreplace;
|
2002-02-26 17:50:59 +00:00
|
|
|
callbacks->extract = Xextract;
|
2001-02-14 23:41:59 +00:00
|
|
|
callbacks->copy = Xcopy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------
|
|
|
|
* Tests
|
|
|
|
*------------------------------------------------------------------*/
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void TestAPI() {
|
2000-06-27 16:27:02 +00:00
|
|
|
enum { BUF_CAP = 128 };
|
|
|
|
char buf[BUF_CAP], buf2[BUF_CAP];
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
UTransliterator* trans = NULL;
|
|
|
|
int32_t i, n;
|
|
|
|
|
|
|
|
/* Test getAvailableIDs */
|
|
|
|
n = utrans_countAvailableIDs();
|
|
|
|
if (n < 1) {
|
|
|
|
log_err("FAIL: utrans_countAvailableIDs() returned %d\n", n);
|
|
|
|
} else {
|
|
|
|
log_verbose("System ID count: %d\n", n);
|
|
|
|
}
|
|
|
|
for (i=0; i<n; ++i) {
|
|
|
|
utrans_getAvailableID(i, buf, BUF_CAP);
|
|
|
|
if (*buf == 0) {
|
|
|
|
log_err("FAIL: System transliterator %d: \"\"\n", i);
|
|
|
|
} else {
|
|
|
|
log_verbose("System transliterator %d: \"%s\"\n", i, buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Test open */
|
|
|
|
utrans_getAvailableID(0, buf, BUF_CAP);
|
2001-08-31 03:23:39 +00:00
|
|
|
trans = utrans_open(buf, UTRANS_FORWARD,NULL,0,NULL, &status);
|
2000-06-27 16:27:02 +00:00
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_open(%s) failed, error=%s\n",
|
|
|
|
buf, u_errorName(status));
|
|
|
|
}
|
2003-06-05 16:42:21 +00:00
|
|
|
|
|
|
|
else {
|
|
|
|
/* Test getID */
|
|
|
|
utrans_getID(trans, buf2, BUF_CAP);
|
|
|
|
if (0 != strcmp(buf, buf2)) {
|
|
|
|
log_err("FAIL: utrans_getID(%s) returned %s\n",
|
|
|
|
buf, buf2);
|
|
|
|
}
|
|
|
|
utrans_close(trans);
|
2000-06-27 16:27:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-02 17:57:02 +00:00
|
|
|
static void TestUnicodeIDs() {
|
|
|
|
UEnumeration *uenum;
|
|
|
|
UTransliterator *utrans;
|
|
|
|
const UChar *id, *id2;
|
|
|
|
int32_t idLength, id2Length, count, count2;
|
|
|
|
|
|
|
|
UErrorCode errorCode;
|
|
|
|
|
|
|
|
errorCode=U_ZERO_ERROR;
|
|
|
|
uenum=utrans_openIDs(&errorCode);
|
|
|
|
if(U_FAILURE(errorCode)) {
|
|
|
|
log_err("utrans_openIDs() failed - %s\n", u_errorName(errorCode));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
count=uenum_count(uenum, &errorCode);
|
|
|
|
if(U_FAILURE(errorCode) || count<1) {
|
|
|
|
log_err("uenum_count(transliterator IDs)=%d - %s\n", count, u_errorName(errorCode));
|
|
|
|
}
|
|
|
|
|
|
|
|
count=0;
|
|
|
|
for(;;) {
|
|
|
|
id=uenum_unext(uenum, &idLength, &errorCode);
|
|
|
|
if(U_FAILURE(errorCode)) {
|
|
|
|
log_err("uenum_unext(transliterator ID %d) failed - %s\n", count, u_errorName(errorCode));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(id==NULL) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-09-16 22:48:37 +00:00
|
|
|
if(++count>10) {
|
2003-07-02 17:57:02 +00:00
|
|
|
/* try to actually open only a few transliterators */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
utrans=utrans_openU(id, idLength, UTRANS_FORWARD, NULL, 0, NULL, &errorCode);
|
|
|
|
if(U_FAILURE(errorCode)) {
|
|
|
|
log_err("utrans_openU(%s) failed - %s\n", aescstrdup(id, idLength), u_errorName(errorCode));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
id2=utrans_getUnicodeID(utrans, &id2Length);
|
|
|
|
if(idLength!=id2Length || 0!=u_memcmp(id, id2, idLength)) {
|
|
|
|
log_err("utrans_getUnicodeID(%s) does not match the original ID\n", aescstrdup(id, idLength));
|
|
|
|
}
|
|
|
|
|
|
|
|
utrans_close(utrans);
|
|
|
|
}
|
|
|
|
|
|
|
|
uenum_reset(uenum, &errorCode);
|
|
|
|
if(U_FAILURE(errorCode) || count<1) {
|
|
|
|
log_err("uenum_reset(transliterator IDs) failed - %s\n", u_errorName(errorCode));
|
|
|
|
} else {
|
|
|
|
count2=uenum_count(uenum, &errorCode);
|
|
|
|
if(U_FAILURE(errorCode) || count<1) {
|
|
|
|
log_err("2nd uenum_count(transliterator IDs)=%d - %s\n", count2, u_errorName(errorCode));
|
|
|
|
} else if(count!=count2) {
|
|
|
|
log_err("uenum_unext(transliterator IDs) returned %d IDs but uenum_count() after uenum_reset() claims there are %d\n", count, count2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uenum_close(uenum);
|
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void TestOpenInverse(){
|
2000-08-03 23:26:38 +00:00
|
|
|
UErrorCode status=U_ZERO_ERROR;
|
|
|
|
UTransliterator* t1=NULL;
|
|
|
|
UTransliterator* inverse1=NULL;
|
|
|
|
enum { BUF_CAP = 128 };
|
|
|
|
char buf1[BUF_CAP];
|
|
|
|
int32_t i=0;
|
|
|
|
|
|
|
|
const char TransID[][25]={
|
|
|
|
"Halfwidth-Fullwidth",
|
|
|
|
"Fullwidth-Halfwidth",
|
|
|
|
"Greek-Latin" ,
|
|
|
|
"Latin-Greek",
|
2001-11-08 18:20:33 +00:00
|
|
|
/*"Arabic-Latin", // Removed in 2.0*/
|
|
|
|
/*"Latin-Arabic", // Removed in 2.0*/
|
2001-11-07 20:07:55 +00:00
|
|
|
"Katakana-Latin",
|
|
|
|
"Latin-Katakana",
|
2001-11-08 18:20:33 +00:00
|
|
|
/*"Hebrew-Latin", // Removed in 2.0*/
|
|
|
|
/*"Latin-Hebrew", // Removed in 2.0*/
|
2000-08-03 23:26:38 +00:00
|
|
|
"Cyrillic-Latin",
|
|
|
|
"Latin-Cyrillic",
|
|
|
|
"Devanagari-Latin",
|
|
|
|
"Latin-Devanagari",
|
2001-08-03 20:20:28 +00:00
|
|
|
"Any-Hex",
|
|
|
|
"Hex-Any"
|
2000-08-03 23:26:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
for(i=0; i<sizeof(TransID)/sizeof(TransID[0]); i=i+2){
|
2001-11-07 20:07:55 +00:00
|
|
|
status = U_ZERO_ERROR;
|
2001-08-31 03:23:39 +00:00
|
|
|
t1=utrans_open(TransID[i], UTRANS_FORWARD,NULL,0,NULL, &status);
|
2000-11-21 04:05:39 +00:00
|
|
|
if(t1 == NULL || U_FAILURE(status)){
|
2009-06-09 21:28:13 +00:00
|
|
|
log_data_err("FAIL: in instantiation for id=%s -> %s (Are you missing data?)\n", TransID[i], u_errorName(status));
|
2000-11-21 04:05:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2000-08-03 23:26:38 +00:00
|
|
|
inverse1=utrans_openInverse(t1, &status);
|
|
|
|
if(U_FAILURE(status)){
|
|
|
|
log_err("FAIL: utrans_openInverse() failed for id=%s. Error=%s\n", TransID[i], myErrorName(status));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
utrans_getID(inverse1, buf1, BUF_CAP);
|
2003-04-23 05:49:02 +00:00
|
|
|
if(strcmp(buf1, TransID[i+1]) != 0){
|
2000-08-03 23:26:38 +00:00
|
|
|
log_err("FAIL :openInverse() for %s returned %s instead of %s\n", TransID[i], buf1, TransID[i+1]);
|
|
|
|
}
|
|
|
|
utrans_close(t1);
|
2000-11-21 04:05:39 +00:00
|
|
|
utrans_close(inverse1);
|
2000-08-03 23:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void TestClone(){
|
2000-08-03 23:26:38 +00:00
|
|
|
UErrorCode status=U_ZERO_ERROR;
|
|
|
|
UTransliterator* t1=NULL;
|
|
|
|
UTransliterator* t2=NULL;
|
|
|
|
UTransliterator* t3=NULL;
|
|
|
|
UTransliterator* t4=NULL;
|
|
|
|
enum { BUF_CAP = 128 };
|
|
|
|
char buf1[BUF_CAP], buf2[BUF_CAP], buf3[BUF_CAP];
|
|
|
|
|
2001-08-31 03:23:39 +00:00
|
|
|
t1=utrans_open("Latin-Devanagari", UTRANS_FORWARD, NULL,0,NULL,&status);
|
2000-08-03 23:26:38 +00:00
|
|
|
if(U_FAILURE(status)){
|
2009-06-09 21:28:13 +00:00
|
|
|
log_data_err("FAIL: construction -> %s (Are you missing data?)\n", u_errorName(status));
|
2000-08-03 23:26:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-11-07 20:07:55 +00:00
|
|
|
t2=utrans_open("Latin-Greek", UTRANS_FORWARD, NULL,0,NULL,&status);
|
2000-11-21 04:05:39 +00:00
|
|
|
if(U_FAILURE(status)){
|
2000-08-03 23:26:38 +00:00
|
|
|
log_err("FAIL: construction\n");
|
|
|
|
utrans_close(t1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
t3=utrans_clone(t1, &status);
|
|
|
|
t4=utrans_clone(t2, &status);
|
2000-08-03 23:26:38 +00:00
|
|
|
|
|
|
|
utrans_getID(t1, buf1, BUF_CAP);
|
|
|
|
utrans_getID(t2, buf2, BUF_CAP);
|
|
|
|
utrans_getID(t3, buf3, BUF_CAP);
|
|
|
|
|
2003-04-23 05:49:02 +00:00
|
|
|
if(strcmp(buf1, buf3) != 0 ||
|
|
|
|
strcmp(buf1, buf2) == 0) {
|
2000-08-03 23:26:38 +00:00
|
|
|
log_err("FAIL: utrans_clone() failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
utrans_getID(t4, buf3, BUF_CAP);
|
|
|
|
|
2003-04-23 05:49:02 +00:00
|
|
|
if(strcmp(buf2, buf3) != 0 ||
|
|
|
|
strcmp(buf1, buf3) == 0) {
|
2000-08-03 23:26:38 +00:00
|
|
|
log_err("FAIL: utrans_clone() failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
utrans_close(t1);
|
|
|
|
utrans_close(t2);
|
2000-08-14 23:14:23 +00:00
|
|
|
utrans_close(t3);
|
|
|
|
utrans_close(t4);
|
2000-08-03 23:26:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void TestRegisterUnregister(){
|
2000-08-03 23:26:38 +00:00
|
|
|
UErrorCode status=U_ZERO_ERROR;
|
|
|
|
UTransliterator* t1=NULL;
|
2003-07-02 17:57:02 +00:00
|
|
|
UTransliterator* rules=NULL, *rules2;
|
2000-08-03 23:26:38 +00:00
|
|
|
UTransliterator* inverse1=NULL;
|
|
|
|
UChar rule[]={ 0x0061, 0x003c, 0x003e, 0x0063}; /*a<>b*/
|
|
|
|
|
2003-07-02 17:57:02 +00:00
|
|
|
U_STRING_DECL(ID, "TestA-TestB", 11);
|
|
|
|
U_STRING_INIT(ID, "TestA-TestB", 11);
|
|
|
|
|
2000-08-03 23:26:38 +00:00
|
|
|
/* Make sure it doesn't exist */
|
2001-08-31 03:23:39 +00:00
|
|
|
t1=utrans_open("TestA-TestB", UTRANS_FORWARD,NULL,0,NULL, &status);
|
2000-08-03 23:26:38 +00:00
|
|
|
if(t1 != NULL || U_SUCCESS(status)) {
|
|
|
|
log_err("FAIL: TestA-TestB already registered\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
/* Check inverse too */
|
2001-08-31 03:23:39 +00:00
|
|
|
inverse1=utrans_open("TestA-TestB", UTRANS_REVERSE, NULL,0,NULL,&status);
|
2000-08-03 23:26:38 +00:00
|
|
|
if(inverse1 != NULL || U_SUCCESS(status)) {
|
|
|
|
log_err("FAIL: TestA-TestB already registered\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
/* Create it */
|
2001-08-31 03:23:39 +00:00
|
|
|
rules=utrans_open("TestA-TestB",UTRANS_FORWARD, rule, 4, NULL, &status);
|
2000-08-03 23:26:38 +00:00
|
|
|
if(U_FAILURE(status)){
|
|
|
|
log_err("FAIL: utrans_openRules(a<>B) failed with error=%s\n", myErrorName(status));
|
|
|
|
return;
|
|
|
|
}
|
2003-07-02 17:57:02 +00:00
|
|
|
|
|
|
|
/* clone it so we can register it a second time */
|
|
|
|
rules2=utrans_clone(rules, &status);
|
|
|
|
if(U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_clone(a<>B) failed with error=%s\n", myErrorName(status));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-08-03 23:26:38 +00:00
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
/* Register it */
|
|
|
|
utrans_register(rules, &status);
|
|
|
|
if(U_FAILURE(status)){
|
|
|
|
log_err("FAIL: utrans_register failed with error=%s\n", myErrorName(status));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
/* Now check again -- should exist now*/
|
2001-08-31 03:23:39 +00:00
|
|
|
t1= utrans_open("TestA-TestB", UTRANS_FORWARD, NULL,0,NULL,&status);
|
2000-08-03 23:26:38 +00:00
|
|
|
if(U_FAILURE(status) || t1 == NULL){
|
|
|
|
log_err("FAIL: TestA-TestB not registered\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
utrans_close(t1);
|
|
|
|
|
|
|
|
/*unregister the instance*/
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
utrans_unregister("TestA-TestB");
|
|
|
|
/* now Make sure it doesn't exist */
|
2001-08-31 03:23:39 +00:00
|
|
|
t1=utrans_open("TestA-TestB", UTRANS_FORWARD,NULL,0,NULL, &status);
|
2000-08-03 23:26:38 +00:00
|
|
|
if(U_SUCCESS(status) || t1 != NULL) {
|
|
|
|
log_err("FAIL: TestA-TestB isn't unregistered\n");
|
|
|
|
return;
|
|
|
|
}
|
2003-07-02 17:57:02 +00:00
|
|
|
utrans_close(t1);
|
|
|
|
|
|
|
|
/* now with utrans_unregisterID(const UChar *) */
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
utrans_register(rules2, &status);
|
|
|
|
if(U_FAILURE(status)){
|
|
|
|
log_err("FAIL: 2nd utrans_register failed with error=%s\n", myErrorName(status));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
/* Now check again -- should exist now*/
|
|
|
|
t1= utrans_open("TestA-TestB", UTRANS_FORWARD, NULL,0,NULL,&status);
|
|
|
|
if(U_FAILURE(status) || t1 == NULL){
|
|
|
|
log_err("FAIL: 2nd TestA-TestB not registered\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
utrans_close(t1);
|
|
|
|
|
|
|
|
/*unregister the instance*/
|
|
|
|
status=U_ZERO_ERROR;
|
|
|
|
utrans_unregisterID(ID, -1);
|
|
|
|
/* now Make sure it doesn't exist */
|
|
|
|
t1=utrans_openU(ID, -1, UTRANS_FORWARD,NULL,0,NULL, &status);
|
|
|
|
if(U_SUCCESS(status) || t1 != NULL) {
|
|
|
|
log_err("FAIL: 2nd TestA-TestB isn't unregistered\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-08-14 23:14:23 +00:00
|
|
|
utrans_close(t1);
|
|
|
|
utrans_close(inverse1);
|
2000-08-03 23:26:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void TestSimpleRules() {
|
2000-06-27 16:27:02 +00:00
|
|
|
/* Test rules */
|
|
|
|
/* Example: rules 1. ab>x|y
|
|
|
|
* 2. yc>z
|
|
|
|
*
|
|
|
|
* []|eabcd start - no match, copy e to tranlated buffer
|
|
|
|
* [e]|abcd match rule 1 - copy output & adjust cursor
|
|
|
|
* [ex|y]cd match rule 2 - copy output & adjust cursor
|
|
|
|
* [exz]|d no match, copy d to transliterated buffer
|
|
|
|
* [exzd]| done
|
|
|
|
*/
|
|
|
|
_expectRules("ab>x|y;"
|
|
|
|
"yc>z",
|
|
|
|
"eabcd", "exzd");
|
|
|
|
|
|
|
|
/* Another set of rules:
|
|
|
|
* 1. ab>x|yzacw
|
|
|
|
* 2. za>q
|
|
|
|
* 3. qc>r
|
|
|
|
* 4. cw>n
|
|
|
|
*
|
|
|
|
* []|ab Rule 1
|
|
|
|
* [x|yzacw] No match
|
|
|
|
* [xy|zacw] Rule 2
|
|
|
|
* [xyq|cw] Rule 4
|
|
|
|
* [xyqn]| Done
|
|
|
|
*/
|
|
|
|
_expectRules("ab>x|yzacw;"
|
|
|
|
"za>q;"
|
|
|
|
"qc>r;"
|
|
|
|
"cw>n",
|
|
|
|
"ab", "xyqn");
|
|
|
|
|
|
|
|
/* Test categories
|
|
|
|
*/
|
|
|
|
_expectRules("$dummy=" "\\uE100" ";" /* careful here with E100 */
|
|
|
|
"$vowel=[aeiouAEIOU];"
|
|
|
|
"$lu=[:Lu:];"
|
|
|
|
"$vowel } $lu > '!';"
|
|
|
|
"$vowel > '&';"
|
|
|
|
"'!' { $lu > '^';"
|
|
|
|
"$lu > '*';"
|
|
|
|
"a > ERROR",
|
|
|
|
"abcdefgABCDEFGU", "&bcd&fg!^**!^*&");
|
2009-04-17 01:02:11 +00:00
|
|
|
|
|
|
|
/* Test multiple passes
|
|
|
|
*/
|
|
|
|
_expectRules("abc > xy;"
|
|
|
|
"::Null;"
|
|
|
|
"aba > z;",
|
|
|
|
"abc ababc aba", "xy abxy z");
|
2000-06-27 16:27:02 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void TestFilter() {
|
2000-06-28 23:30:05 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
UChar filt[128];
|
|
|
|
UChar buf[128];
|
|
|
|
UChar exp[128];
|
2003-07-02 17:57:02 +00:00
|
|
|
char *cbuf;
|
2000-06-28 23:30:05 +00:00
|
|
|
int32_t limit;
|
|
|
|
const char* DATA[] = {
|
|
|
|
"[^c]", /* Filter out 'c' */
|
|
|
|
"abcde",
|
|
|
|
"\\u0061\\u0062c\\u0064\\u0065",
|
|
|
|
|
|
|
|
"", /* No filter */
|
|
|
|
"abcde",
|
|
|
|
"\\u0061\\u0062\\u0063\\u0064\\u0065"
|
|
|
|
};
|
|
|
|
int32_t DATA_length = sizeof(DATA) / sizeof(DATA[0]);
|
|
|
|
int32_t i;
|
|
|
|
|
2001-08-31 03:23:39 +00:00
|
|
|
UTransliterator* hex = utrans_open("Any-Hex", UTRANS_FORWARD, NULL,0,NULL,&status);
|
2000-06-28 23:30:05 +00:00
|
|
|
|
|
|
|
if (hex == 0 || U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_open(Unicode-Hex) failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<DATA_length; i+=3) {
|
2000-08-02 19:06:18 +00:00
|
|
|
/*u_uastrcpy(filt, DATA[i]);*/
|
2004-11-05 00:25:35 +00:00
|
|
|
u_charsToUChars(DATA[i], filt, (int32_t)strlen(DATA[i])+1);
|
2000-06-28 23:30:05 +00:00
|
|
|
utrans_setFilter(hex, filt, -1, &status);
|
|
|
|
|
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_setFilter() failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2000-08-02 19:06:18 +00:00
|
|
|
/*u_uastrcpy(buf, DATA[i+1]);*/
|
2004-11-05 00:25:35 +00:00
|
|
|
u_charsToUChars(DATA[i+1], buf, (int32_t)strlen(DATA[i+1])+1);
|
2000-06-28 23:30:05 +00:00
|
|
|
limit = 5;
|
|
|
|
utrans_transUChars(hex, buf, NULL, 128, 0, &limit, &status);
|
|
|
|
|
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_transUChars() failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2003-07-02 17:57:02 +00:00
|
|
|
cbuf=aescstrdup(buf, -1);
|
2004-11-05 00:25:35 +00:00
|
|
|
u_charsToUChars(DATA[i+2], exp, (int32_t)strlen(DATA[i+2])+1);
|
2000-06-28 23:30:05 +00:00
|
|
|
if (0 == u_strcmp(buf, exp)) {
|
|
|
|
log_verbose("Ok: %s | %s -> %s\n", DATA[i+1], DATA[i], cbuf);
|
|
|
|
} else {
|
|
|
|
log_err("FAIL: %s | %s -> %s, expected %s\n", DATA[i+1], DATA[i], cbuf, DATA[i+2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit:
|
|
|
|
utrans_close(hex);
|
|
|
|
}
|
|
|
|
|
2002-02-26 17:50:59 +00:00
|
|
|
/**
|
|
|
|
* Test the UReplaceableCallback extractBetween support. We use a
|
|
|
|
* transliterator known to rely on this call.
|
|
|
|
*/
|
|
|
|
static void TestExtractBetween() {
|
|
|
|
|
|
|
|
UTransliterator *trans;
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
UParseError parseErr;
|
|
|
|
|
|
|
|
trans = utrans_open("Lower", UTRANS_FORWARD, NULL, -1,
|
|
|
|
&parseErr, &status);
|
|
|
|
|
2003-06-05 16:42:21 +00:00
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_open(Lower) failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
|
|
|
} else {
|
|
|
|
_expect(trans, "ABC", "abc");
|
2002-02-26 17:50:59 +00:00
|
|
|
|
2003-06-05 16:42:21 +00:00
|
|
|
utrans_close(trans);
|
|
|
|
}
|
2002-02-26 17:50:59 +00:00
|
|
|
}
|
|
|
|
|
2014-01-13 07:27:02 +00:00
|
|
|
/**
|
|
|
|
* Test utrans_toRules, utrans_getSourceSet
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* A simple transform with a small filter & source set: rules 50-100 chars unescaped, 100-200 chars escaped,
|
|
|
|
filter & source set 4-20 chars */
|
|
|
|
static const UChar transSimpleID[] = { 0x79,0x6F,0x2D,0x79,0x6F,0x5F,0x42,0x4A,0 }; /* "yo-yo_BJ" */
|
|
|
|
static const char* transSimpleCName = "yo-yo_BJ";
|
|
|
|
|
|
|
|
enum { kUBufMax = 256 };
|
|
|
|
static void TestGetRulesAndSourceSet() {
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
UTransliterator *utrans = utrans_openU(transSimpleID, -1, UTRANS_FORWARD, NULL, 0, NULL, &status);
|
|
|
|
if ( U_SUCCESS(status) ) {
|
|
|
|
USet* uset;
|
|
|
|
UChar ubuf[kUBufMax];
|
|
|
|
int32_t ulen;
|
|
|
|
|
|
|
|
status = U_ZERO_ERROR;
|
|
|
|
ulen = utrans_toRules(utrans, FALSE, ubuf, kUBufMax, &status);
|
|
|
|
if ( U_FAILURE(status) || ulen <= 50 || ulen >= 100) {
|
|
|
|
log_err("FAIL: utrans_toRules unescaped, expected noErr and len 50-100, got error=%s and len=%d\n",
|
|
|
|
u_errorName(status), ulen);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = U_ZERO_ERROR;
|
|
|
|
ulen = utrans_toRules(utrans, FALSE, NULL, 0, &status);
|
|
|
|
if ( status != U_BUFFER_OVERFLOW_ERROR || ulen <= 50 || ulen >= 100) {
|
|
|
|
log_err("FAIL: utrans_toRules unescaped, expected U_BUFFER_OVERFLOW_ERROR and len 50-100, got error=%s and len=%d\n",
|
|
|
|
u_errorName(status), ulen);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = U_ZERO_ERROR;
|
|
|
|
ulen = utrans_toRules(utrans, TRUE, ubuf, kUBufMax, &status);
|
|
|
|
if ( U_FAILURE(status) || ulen <= 100 || ulen >= 200) {
|
|
|
|
log_err("FAIL: utrans_toRules escaped, expected noErr and len 100-200, got error=%s and len=%d\n",
|
|
|
|
u_errorName(status), ulen);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = U_ZERO_ERROR;
|
|
|
|
uset = utrans_getSourceSet(utrans, FALSE, NULL, &status);
|
|
|
|
ulen = uset_toPattern(uset, ubuf, kUBufMax, FALSE, &status);
|
|
|
|
uset_close(uset);
|
|
|
|
if ( U_FAILURE(status) || ulen <= 4 || ulen >= 20) {
|
|
|
|
log_err("FAIL: utrans_getSourceSet useFilter, expected noErr and len 4-20, got error=%s and len=%d\n",
|
|
|
|
u_errorName(status), ulen);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = U_ZERO_ERROR;
|
|
|
|
uset = utrans_getSourceSet(utrans, TRUE, NULL, &status);
|
|
|
|
ulen = uset_toPattern(uset, ubuf, kUBufMax, FALSE, &status);
|
|
|
|
uset_close(uset);
|
|
|
|
if ( U_FAILURE(status) || ulen <= 4 || ulen >= 20) {
|
|
|
|
log_err("FAIL: utrans_getSourceSet ignoreFilter, expected noErr and len 4-20, got error=%s and len=%d\n",
|
|
|
|
u_errorName(status), ulen);
|
|
|
|
}
|
|
|
|
|
|
|
|
utrans_close(utrans);
|
|
|
|
} else {
|
|
|
|
log_data_err("FAIL: utrans_openRules(%s) failed, error=%s (Are you missing data?)\n",
|
|
|
|
transSimpleCName, u_errorName(status));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void _expectRules(const char* crules,
|
2000-06-27 16:27:02 +00:00
|
|
|
const char* cfrom,
|
|
|
|
const char* cto) {
|
|
|
|
/* u_uastrcpy has no capacity param for the buffer -- so just
|
|
|
|
* make all buffers way too big */
|
|
|
|
enum { CAP = 256 };
|
|
|
|
UChar rules[CAP];
|
|
|
|
UTransliterator *trans;
|
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
UParseError parseErr;
|
|
|
|
|
|
|
|
u_uastrcpy(rules, crules);
|
|
|
|
|
2001-08-31 03:23:39 +00:00
|
|
|
trans = utrans_open(crules /*use rules as ID*/, UTRANS_FORWARD, rules, -1,
|
2000-06-27 16:27:02 +00:00
|
|
|
&parseErr, &status);
|
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
utrans_close(trans);
|
2009-06-09 21:28:13 +00:00
|
|
|
log_data_err("FAIL: utrans_openRules(%s) failed, error=%s (Are you missing data?)\n",
|
2000-06-27 16:27:02 +00:00
|
|
|
crules, u_errorName(status));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-06-28 23:30:05 +00:00
|
|
|
_expect(trans, cfrom, cto);
|
|
|
|
|
|
|
|
utrans_close(trans);
|
|
|
|
}
|
|
|
|
|
2000-11-21 04:05:39 +00:00
|
|
|
static void _expect(const UTransliterator* trans,
|
2000-06-28 23:30:05 +00:00
|
|
|
const char* cfrom,
|
|
|
|
const char* cto) {
|
|
|
|
/* u_uastrcpy has no capacity param for the buffer -- so just
|
|
|
|
* make all buffers way too big */
|
|
|
|
enum { CAP = 256 };
|
|
|
|
UChar from[CAP];
|
|
|
|
UChar to[CAP];
|
|
|
|
UChar buf[CAP];
|
2003-07-02 17:57:02 +00:00
|
|
|
const UChar *ID;
|
|
|
|
int32_t IDLength;
|
|
|
|
const char *id;
|
|
|
|
|
2000-06-28 23:30:05 +00:00
|
|
|
UErrorCode status = U_ZERO_ERROR;
|
|
|
|
int32_t limit;
|
|
|
|
UTransPosition pos;
|
2001-02-14 23:41:59 +00:00
|
|
|
XReplaceable xrep;
|
2006-04-14 15:49:37 +00:00
|
|
|
XReplaceable *xrepPtr = &xrep;
|
2001-02-14 23:41:59 +00:00
|
|
|
UReplaceableCallbacks xrepVtable;
|
2000-06-28 23:30:05 +00:00
|
|
|
|
|
|
|
u_uastrcpy(from, cfrom);
|
|
|
|
u_uastrcpy(to, cto);
|
|
|
|
|
2003-07-02 17:57:02 +00:00
|
|
|
ID = utrans_getUnicodeID(trans, &IDLength);
|
|
|
|
id = aescstrdup(ID, IDLength);
|
2000-06-28 23:30:05 +00:00
|
|
|
|
2000-06-27 16:27:02 +00:00
|
|
|
/* utrans_transUChars() */
|
|
|
|
u_strcpy(buf, from);
|
|
|
|
limit = u_strlen(buf);
|
|
|
|
utrans_transUChars(trans, buf, NULL, CAP, 0, &limit, &status);
|
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_transUChars() failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == u_strcmp(buf, to)) {
|
|
|
|
log_verbose("Ok: utrans_transUChars(%s) x %s -> %s\n",
|
2000-06-28 23:30:05 +00:00
|
|
|
id, cfrom, cto);
|
2000-06-27 16:27:02 +00:00
|
|
|
} else {
|
|
|
|
char actual[CAP];
|
|
|
|
u_austrcpy(actual, buf);
|
|
|
|
log_err("FAIL: utrans_transUChars(%s) x %s -> %s, expected %s\n",
|
2000-06-28 23:30:05 +00:00
|
|
|
id, cfrom, actual, cto);
|
2000-06-27 16:27:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* utrans_transIncrementalUChars() */
|
|
|
|
u_strcpy(buf, from);
|
2000-06-27 20:07:59 +00:00
|
|
|
pos.start = pos.contextStart = 0;
|
|
|
|
pos.limit = pos.contextLimit = u_strlen(buf);
|
2000-06-27 16:27:02 +00:00
|
|
|
utrans_transIncrementalUChars(trans, buf, NULL, CAP, &pos, &status);
|
2000-06-27 20:07:59 +00:00
|
|
|
utrans_transUChars(trans, buf, NULL, CAP, pos.start, &pos.limit, &status);
|
2000-06-27 16:27:02 +00:00
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_transIncrementalUChars() failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == u_strcmp(buf, to)) {
|
|
|
|
log_verbose("Ok: utrans_transIncrementalUChars(%s) x %s -> %s\n",
|
2000-06-28 23:30:05 +00:00
|
|
|
id, cfrom, cto);
|
2000-06-27 16:27:02 +00:00
|
|
|
} else {
|
|
|
|
char actual[CAP];
|
|
|
|
u_austrcpy(actual, buf);
|
|
|
|
log_err("FAIL: utrans_transIncrementalUChars(%s) x %s -> %s, expected %s\n",
|
2000-06-28 23:30:05 +00:00
|
|
|
id, cfrom, actual, cto);
|
2000-06-27 16:27:02 +00:00
|
|
|
}
|
2001-02-14 23:41:59 +00:00
|
|
|
|
|
|
|
/* utrans_trans() */
|
|
|
|
InitXReplaceableCallbacks(&xrepVtable);
|
|
|
|
InitXReplaceable(&xrep, cfrom);
|
|
|
|
limit = u_strlen(from);
|
2006-04-14 15:49:37 +00:00
|
|
|
utrans_trans(trans, (UReplaceable*)xrepPtr, &xrepVtable, 0, &limit, &status);
|
2001-02-14 23:41:59 +00:00
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_trans() failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
2001-02-15 00:05:10 +00:00
|
|
|
FreeXReplaceable(&xrep);
|
2001-02-14 23:41:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == u_strcmp(xrep.text, to)) {
|
|
|
|
log_verbose("Ok: utrans_trans(%s) x %s -> %s\n",
|
|
|
|
id, cfrom, cto);
|
|
|
|
} else {
|
|
|
|
char actual[CAP];
|
|
|
|
u_austrcpy(actual, xrep.text);
|
|
|
|
log_err("FAIL: utrans_trans(%s) x %s -> %s, expected %s\n",
|
|
|
|
id, cfrom, actual, cto);
|
|
|
|
}
|
|
|
|
FreeXReplaceable(&xrep);
|
|
|
|
|
|
|
|
/* utrans_transIncremental() */
|
|
|
|
InitXReplaceable(&xrep, cfrom);
|
|
|
|
pos.start = pos.contextStart = 0;
|
|
|
|
pos.limit = pos.contextLimit = u_strlen(from);
|
2006-04-14 15:49:37 +00:00
|
|
|
utrans_transIncremental(trans, (UReplaceable*)xrepPtr, &xrepVtable, &pos, &status);
|
|
|
|
utrans_trans(trans, (UReplaceable*)xrepPtr, &xrepVtable, pos.start, &pos.limit, &status);
|
2001-02-14 23:41:59 +00:00
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
log_err("FAIL: utrans_transIncremental() failed, error=%s\n",
|
|
|
|
u_errorName(status));
|
2001-02-15 00:05:10 +00:00
|
|
|
FreeXReplaceable(&xrep);
|
2001-02-14 23:41:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == u_strcmp(xrep.text, to)) {
|
|
|
|
log_verbose("Ok: utrans_transIncremental(%s) x %s -> %s\n",
|
|
|
|
id, cfrom, cto);
|
|
|
|
} else {
|
|
|
|
char actual[CAP];
|
|
|
|
u_austrcpy(actual, xrep.text);
|
|
|
|
log_err("FAIL: utrans_transIncremental(%s) x %s -> %s, expected %s\n",
|
|
|
|
id, cfrom, actual, cto);
|
|
|
|
}
|
|
|
|
FreeXReplaceable(&xrep);
|
2000-06-27 16:27:02 +00:00
|
|
|
}
|
2002-09-20 17:54:45 +00:00
|
|
|
|
|
|
|
#endif /* #if !UCONFIG_NO_TRANSLITERATION */
|