OLD | NEW |
1 // Copyright (C) 2016 and later: Unicode, Inc. and others. | 1 // Copyright (C) 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
3 /******************************************************************** | 3 /******************************************************************** |
4 * COPYRIGHT: | 4 * COPYRIGHT: |
5 * Copyright (c) 1997-2016, International Business Machines Corporation and | 5 * Copyright (c) 1997-2016, International Business Machines Corporation and |
6 * others. All Rights Reserved. | 6 * others. All Rights Reserved. |
7 ********************************************************************/ | 7 ********************************************************************/ |
8 /******************************************************************************* | 8 /******************************************************************************* |
9 * | 9 * |
10 * File CUCDTST.C | 10 * File CUCDTST.C |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "unicode/unorm2.h" | 27 #include "unicode/unorm2.h" |
28 | 28 |
29 #include "cintltst.h" | 29 #include "cintltst.h" |
30 #include "putilimp.h" | 30 #include "putilimp.h" |
31 #include "uparse.h" | 31 #include "uparse.h" |
32 #include "ucase.h" | 32 #include "ucase.h" |
33 #include "ubidi_props.h" | 33 #include "ubidi_props.h" |
34 #include "uprops.h" | 34 #include "uprops.h" |
35 #include "uset_imp.h" | 35 #include "uset_imp.h" |
36 #include "usc_impl.h" | 36 #include "usc_impl.h" |
37 #include "udatamem.h" /* for testing ucase_openBinary() */ | 37 #include "udatamem.h" |
38 #include "cucdapi.h" | 38 #include "cucdapi.h" |
39 #include "cmemory.h" | 39 #include "cmemory.h" |
40 | 40 |
41 /* prototypes --------------------------------------------------------------- */ | 41 /* prototypes --------------------------------------------------------------- */ |
42 | 42 |
43 static void TestUpperLower(void); | 43 static void TestUpperLower(void); |
44 static void TestLetterNumber(void); | 44 static void TestLetterNumber(void); |
45 static void TestMisc(void); | 45 static void TestMisc(void); |
46 static void TestPOSIX(void); | 46 static void TestPOSIX(void); |
47 static void TestControlPrint(void); | 47 static void TestControlPrint(void); |
48 static void TestIdentifier(void); | 48 static void TestIdentifier(void); |
49 static void TestUnicodeData(void); | 49 static void TestUnicodeData(void); |
50 static void TestCodeUnit(void); | 50 static void TestCodeUnit(void); |
51 static void TestCodePoint(void); | 51 static void TestCodePoint(void); |
52 static void TestCharLength(void); | 52 static void TestCharLength(void); |
53 static void TestCharNames(void); | 53 static void TestCharNames(void); |
54 static void TestUCharFromNameUnderflow(void); | 54 static void TestUCharFromNameUnderflow(void); |
55 static void TestMirroring(void); | 55 static void TestMirroring(void); |
56 static void TestUScriptRunAPI(void); | 56 static void TestUScriptRunAPI(void); |
57 static void TestAdditionalProperties(void); | 57 static void TestAdditionalProperties(void); |
58 static void TestNumericProperties(void); | 58 static void TestNumericProperties(void); |
59 static void TestPropertyNames(void); | 59 static void TestPropertyNames(void); |
60 static void TestPropertyValues(void); | 60 static void TestPropertyValues(void); |
61 static void TestConsistency(void); | 61 static void TestConsistency(void); |
62 static void TestUCase(void); | |
63 static void TestUBiDiProps(void); | 62 static void TestUBiDiProps(void); |
64 static void TestCaseFolding(void); | 63 static void TestCaseFolding(void); |
65 | 64 |
66 /* internal methods used */ | 65 /* internal methods used */ |
67 static int32_t MakeProp(char* str); | 66 static int32_t MakeProp(char* str); |
68 static int32_t MakeDir(char* str); | 67 static int32_t MakeDir(char* str); |
69 | 68 |
70 /* helpers ------------------------------------------------------------------ */ | 69 /* helpers ------------------------------------------------------------------ */ |
71 | 70 |
72 static void | 71 static void |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 addTest(root, &TestUCharFromNameUnderflow, "tsutil/cucdtst/TestUCharFromName
Underflow"); | 188 addTest(root, &TestUCharFromNameUnderflow, "tsutil/cucdtst/TestUCharFromName
Underflow"); |
190 addTest(root, &TestMirroring, "tsutil/cucdtst/TestMirroring"); | 189 addTest(root, &TestMirroring, "tsutil/cucdtst/TestMirroring"); |
191 addTest(root, &TestUScriptCodeAPI, "tsutil/cucdtst/TestUScriptCodeAPI"); | 190 addTest(root, &TestUScriptCodeAPI, "tsutil/cucdtst/TestUScriptCodeAPI"); |
192 addTest(root, &TestHasScript, "tsutil/cucdtst/TestHasScript"); | 191 addTest(root, &TestHasScript, "tsutil/cucdtst/TestHasScript"); |
193 addTest(root, &TestGetScriptExtensions, "tsutil/cucdtst/TestGetScriptExtensi
ons"); | 192 addTest(root, &TestGetScriptExtensions, "tsutil/cucdtst/TestGetScriptExtensi
ons"); |
194 addTest(root, &TestScriptMetadataAPI, "tsutil/cucdtst/TestScriptMetadataAPI"
); | 193 addTest(root, &TestScriptMetadataAPI, "tsutil/cucdtst/TestScriptMetadataAPI"
); |
195 addTest(root, &TestUScriptRunAPI, "tsutil/cucdtst/TestUScriptRunAPI"); | 194 addTest(root, &TestUScriptRunAPI, "tsutil/cucdtst/TestUScriptRunAPI"); |
196 addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames"); | 195 addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames"); |
197 addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues"); | 196 addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues"); |
198 addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency"); | 197 addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency"); |
199 addTest(root, &TestUCase, "tsutil/cucdtst/TestUCase"); | |
200 addTest(root, &TestUBiDiProps, "tsutil/cucdtst/TestUBiDiProps"); | 198 addTest(root, &TestUBiDiProps, "tsutil/cucdtst/TestUBiDiProps"); |
201 addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding"); | 199 addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding"); |
202 } | 200 } |
203 | 201 |
204 /*==================================================== */ | 202 /*==================================================== */ |
205 /* test u_toupper() and u_tolower() */ | 203 /* test u_toupper() and u_tolower() */ |
206 /*==================================================== */ | 204 /*==================================================== */ |
207 static void TestUpperLower() | 205 static void TestUpperLower() |
208 { | 206 { |
209 const UChar upper[] = {0x41, 0x42, 0x00b2, 0x01c4, 0x01c6, 0x01c9, 0x01c8, 0
x01c9, 0x000c, 0x0000}; | 207 const UChar upper[] = {0x41, 0x42, 0x00b2, 0x01c4, 0x01c6, 0x01c9, 0x01c8, 0
x01c9, 0x000c, 0x0000}; |
(...skipping 3039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3249 * (uprops.icu, ucase.icu, ubidi.icu, unorm.icu) | 3247 * (uprops.icu, ucase.icu, ubidi.icu, unorm.icu) |
3250 * are hardcoded in the common DLL and therefore not included | 3248 * are hardcoded in the common DLL and therefore not included |
3251 * in the data package any more. | 3249 * in the data package any more. |
3252 * Test requiring these files are disabled so that | 3250 * Test requiring these files are disabled so that |
3253 * we need not jump through hoops (like adding snapshots of these files | 3251 * we need not jump through hoops (like adding snapshots of these files |
3254 * to testdata). | 3252 * to testdata). |
3255 * See Jitterbug 4497. | 3253 * See Jitterbug 4497. |
3256 */ | 3254 */ |
3257 #define HARDCODED_DATA_4497 1 | 3255 #define HARDCODED_DATA_4497 1 |
3258 | 3256 |
3259 /* API coverage for ucase.c */ | |
3260 static void TestUCase() { | |
3261 #if !HARDCODED_DATA_4497 | |
3262 UDataMemory *pData; | |
3263 UCaseProps *csp; | |
3264 const UCaseProps *ccsp; | |
3265 UErrorCode errorCode; | |
3266 | |
3267 /* coverage for ucase_openBinary() */ | |
3268 errorCode=U_ZERO_ERROR; | |
3269 pData=udata_open(NULL, UCASE_DATA_TYPE, UCASE_DATA_NAME, &errorCode); | |
3270 if(U_FAILURE(errorCode)) { | |
3271 log_data_err("unable to open " UCASE_DATA_NAME "." UCASE_DATA_TYPE ": %s
\n", | |
3272 u_errorName(errorCode)); | |
3273 return; | |
3274 } | |
3275 | |
3276 csp=ucase_openBinary((const uint8_t *)pData->pHeader, -1, &errorCode); | |
3277 if(U_FAILURE(errorCode)) { | |
3278 log_err("ucase_openBinary() fails for the contents of " UCASE_DATA_NAME
"." UCASE_DATA_TYPE ": %s\n", | |
3279 u_errorName(errorCode)); | |
3280 udata_close(pData); | |
3281 return; | |
3282 } | |
3283 | |
3284 if(UCASE_LOWER!=ucase_getType(csp, 0xdf)) { /* verify islower(sharp s) */ | |
3285 log_err("ucase_openBinary() does not seem to return working UCaseProps\n
"); | |
3286 } | |
3287 | |
3288 ucase_close(csp); | |
3289 udata_close(pData); | |
3290 | |
3291 /* coverage for ucase_getDummy() */ | |
3292 errorCode=U_ZERO_ERROR; | |
3293 ccsp=ucase_getDummy(&errorCode); | |
3294 if(ucase_tolower(ccsp, 0x41)!=0x41) { | |
3295 log_err("ucase_tolower(dummy, A)!=A\n"); | |
3296 } | |
3297 #endif | |
3298 } | |
3299 | |
3300 /* API coverage for ubidi_props.c */ | 3257 /* API coverage for ubidi_props.c */ |
3301 static void TestUBiDiProps() { | 3258 static void TestUBiDiProps() { |
3302 #if !HARDCODED_DATA_4497 | 3259 #if !HARDCODED_DATA_4497 |
3303 UDataMemory *pData; | 3260 UDataMemory *pData; |
3304 UBiDiProps *bdp; | 3261 UBiDiProps *bdp; |
3305 const UBiDiProps *cbdp; | 3262 const UBiDiProps *cbdp; |
3306 UErrorCode errorCode; | 3263 UErrorCode errorCode; |
3307 | 3264 |
3308 /* coverage for ubidi_openBinary() */ | 3265 /* coverage for ubidi_openBinary() */ |
3309 errorCode=U_ZERO_ERROR; | 3266 errorCode=U_ZERO_ERROR; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3545 ++i | 3502 ++i |
3546 ) { | 3503 ) { |
3547 do { | 3504 do { |
3548 testFoldToSelf(start, CF_ALL); | 3505 testFoldToSelf(start, CF_ALL); |
3549 } while(++start<=end); | 3506 } while(++start<=end); |
3550 } | 3507 } |
3551 } | 3508 } |
3552 | 3509 |
3553 uset_close(data.notSeen); | 3510 uset_close(data.notSeen); |
3554 } | 3511 } |
OLD | NEW |