OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * Copyright (c) 2013, International Business Machines Corporation | 2 * Copyright (c) 2014, International Business Machines Corporation |
3 * and others. All Rights Reserved. | 3 * and others. All Rights Reserved. |
4 ********************************************************************/ | 4 ********************************************************************/ |
5 /* C API TEST FOR UREGION */ | 5 /* C API TEST FOR UREGION */ |
6 /*********************************************************************** | 6 /*********************************************************************** |
7 * Test cases ported from ICU4J ( RegionTest.java ) | 7 * Test cases ported from ICU4J ( RegionTest.java ) |
8 * to C++ (regiontst.cpp) to here. | 8 * to C++ (regiontst.cpp) to here. |
9 * Try to keep them in sync if at all possible...! | 9 * Try to keep them in sync if at all possible...! |
10 ***********************************************************************/ | 10 ***********************************************************************/ |
11 | 11 |
12 #include "unicode/utypes.h" | 12 #include "unicode/utypes.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 typedef struct KnownRegion { | 46 typedef struct KnownRegion { |
47 const char *code; | 47 const char *code; |
48 int32_t numeric; | 48 int32_t numeric; |
49 const char *parent; | 49 const char *parent; |
50 URegionType type; | 50 URegionType type; |
51 const char *containingContinent; | 51 const char *containingContinent; |
52 } KnownRegion; | 52 } KnownRegion; |
53 | 53 |
54 #define LENGTHOF(array) (int32_t)(sizeof(array) / sizeof((array)[0])) | |
55 | |
56 static KnownRegion knownRegions[] = { | 54 static KnownRegion knownRegions[] = { |
57 // Code, Num, Parent, Type, Containing Continent | 55 // Code, Num, Parent, Type, Containing Continent |
58 { "TP" , 626, "035", URGN_TERRITORY, "142" }, | 56 { "TP" , 626, "035", URGN_TERRITORY, "142" }, |
59 { "001", 1, NULL , URGN_WORLD, NULL }, | 57 { "001", 1, NULL , URGN_WORLD, NULL }, |
60 { "002", 2, "001", URGN_CONTINENT, NULL }, | 58 { "002", 2, "001", URGN_CONTINENT, NULL }, |
61 { "003", 3, NULL, URGN_GROUPING, NULL }, | 59 { "003", 3, NULL, URGN_GROUPING, NULL }, |
62 { "005", 5, "019", URGN_SUBCONTINENT, "019" }, | 60 { "005", 5, "019", URGN_SUBCONTINENT, "019" }, |
63 { "009", 9, "001", URGN_CONTINENT, NULL}, | 61 { "009", 9, "001", URGN_CONTINENT, NULL}, |
64 { "011", 11, "002", URGN_SUBCONTINENT, "002" }, | 62 { "011", 11, "002", URGN_SUBCONTINENT, "002" }, |
65 { "013", 13, "019", URGN_SUBCONTINENT, "019" }, | 63 { "013", 13, "019", URGN_SUBCONTINENT, "019" }, |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 555 } |
558 c = uregion_getContainingRegion(c); | 556 c = uregion_getContainingRegion(c); |
559 } | 557 } |
560 } else { | 558 } else { |
561 log_data_err("ERROR: Known region %s was not recognized.\n", rd->cod
e); | 559 log_data_err("ERROR: Known region %s was not recognized.\n", rd->cod
e); |
562 } | 560 } |
563 } | 561 } |
564 } | 562 } |
565 | 563 |
566 #endif /* #if !UCONFIG_NO_FORMATTING */ | 564 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |