]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/gencolusb/verify_uset.cpp
2 * Copyright (c) 1999-2012, International Business Machines Corporation and
3 * others. All Rights Reserved.
5 * Test for source/i18n/collunsafe.h
9 #include "unicode/ucol.h"
10 #include "unicode/uniset.h"
11 #include "unicode/coll.h"
12 #include "collation.h"
14 #include "collunsafe.h"
17 int main(int argc
, const char *argv
[]) {
19 UErrorCode errorCode
= U_ZERO_ERROR
;
20 #if defined (COLLUNSAFE_PATTERN)
21 puts("verify pattern");
22 const UnicodeString
unsafeBackwardPattern(FALSE
, collunsafe_pattern
, collunsafe_len
);
23 fprintf(stderr
, "\n -- pat '%c%c%c%c%c'\n",
24 collunsafe_pattern
[0],
25 collunsafe_pattern
[1],
26 collunsafe_pattern
[2],
27 collunsafe_pattern
[3],
28 collunsafe_pattern
[4]);
29 if(U_SUCCESS(errorCode
)) {
30 UnicodeSet
us(unsafeBackwardPattern
, errorCode
);
31 fprintf(stderr
, "\n%s:%d: err creating set %s\n", __FILE__
, __LINE__
, u_errorName(errorCode
));
35 #if defined (COLLUNSAFE_RANGE)
39 for(int32_t i
=0;i
<unsafe_rangeCount
*2;i
+=2) {
40 u
.add(unsafe_ranges
[i
+0],unsafe_ranges
[i
+1]);
42 printf("Finished with %d ranges\n", u
.getRangeCount());
46 #if defined (COLLUNSAFE_SERIALIZE)
48 puts("verify serialize");
49 UnicodeSet
u(unsafe_serializedData
, unsafe_serializedCount
, UnicodeSet::kSerialized
, errorCode
);
50 fprintf(stderr
, "\n%s:%d: err creating set %s\n", __FILE__
, __LINE__
, u_errorName(errorCode
));
51 printf("Finished deserialize with %d ranges\n", u
.getRangeCount());
54 // if(tailoring.unsafeBackwardSet == NULL) {
55 // errorCode = U_MEMORY_ALLOCATION_ERROR;
56 // fprintf(stderr, "\n%s:%d: err %s\n", __FILE__, __LINE__, u_errorName(errorCode));
58 puts("verify col UCA");
59 if(U_SUCCESS(errorCode
)) {
60 Collator
*col
= Collator::createInstance(Locale::getEnglish(), errorCode
);
61 fprintf(stderr
, "\n%s:%d: err %s creating collator\n", __FILE__
, __LINE__
, u_errorName(errorCode
));
64 if(U_FAILURE(errorCode
)) {