OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2013, International Business Machines Corporation and | 3 * Copyright (c) 1997-2014, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 /******************************************************************************* | 6 /******************************************************************************* |
7 * | 7 * |
8 * File CUCDTST.C | 8 * File CUCDTST.C |
9 * | 9 * |
10 * Modification History: | 10 * Modification History: |
11 * Name Description | 11 * Name Description |
12 * Madhu Katragadda Ported for C API, added tests for string funct
ions | 12 * Madhu Katragadda Ported for C API, added tests for string funct
ions |
13 ******************************************************************************** | 13 ******************************************************************************** |
(...skipping 13 matching lines...) Expand all Loading... |
27 #include "cintltst.h" | 27 #include "cintltst.h" |
28 #include "putilimp.h" | 28 #include "putilimp.h" |
29 #include "uparse.h" | 29 #include "uparse.h" |
30 #include "ucase.h" | 30 #include "ucase.h" |
31 #include "ubidi_props.h" | 31 #include "ubidi_props.h" |
32 #include "uprops.h" | 32 #include "uprops.h" |
33 #include "uset_imp.h" | 33 #include "uset_imp.h" |
34 #include "usc_impl.h" | 34 #include "usc_impl.h" |
35 #include "udatamem.h" /* for testing ucase_openBinary() */ | 35 #include "udatamem.h" /* for testing ucase_openBinary() */ |
36 #include "cucdapi.h" | 36 #include "cucdapi.h" |
37 | 37 #include "cmemory.h" |
38 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
39 | 38 |
40 /* prototypes --------------------------------------------------------------- */ | 39 /* prototypes --------------------------------------------------------------- */ |
41 | 40 |
42 static void TestUpperLower(void); | 41 static void TestUpperLower(void); |
43 static void TestLetterNumber(void); | 42 static void TestLetterNumber(void); |
44 static void TestMisc(void); | 43 static void TestMisc(void); |
45 static void TestPOSIX(void); | 44 static void TestPOSIX(void); |
46 static void TestControlPrint(void); | 45 static void TestControlPrint(void); |
47 static void TestIdentifier(void); | 46 static void TestIdentifier(void); |
48 static void TestUnicodeData(void); | 47 static void TestUnicodeData(void); |
49 static void TestCodeUnit(void); | 48 static void TestCodeUnit(void); |
50 static void TestCodePoint(void); | 49 static void TestCodePoint(void); |
51 static void TestCharLength(void); | 50 static void TestCharLength(void); |
52 static void TestCharNames(void); | 51 static void TestCharNames(void); |
| 52 static void TestUCharFromNameUnderflow(void); |
53 static void TestMirroring(void); | 53 static void TestMirroring(void); |
54 static void TestUScriptRunAPI(void); | 54 static void TestUScriptRunAPI(void); |
55 static void TestAdditionalProperties(void); | 55 static void TestAdditionalProperties(void); |
56 static void TestNumericProperties(void); | 56 static void TestNumericProperties(void); |
57 static void TestPropertyNames(void); | 57 static void TestPropertyNames(void); |
58 static void TestPropertyValues(void); | 58 static void TestPropertyValues(void); |
59 static void TestConsistency(void); | 59 static void TestConsistency(void); |
60 static void TestUCase(void); | 60 static void TestUCase(void); |
61 static void TestUBiDiProps(void); | 61 static void TestUBiDiProps(void); |
62 static void TestCaseFolding(void); | 62 static void TestCaseFolding(void); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 *pErrorCode=U_ZERO_ERROR; | 97 *pErrorCode=U_ZERO_ERROR; |
98 u_parseDelimitedFile(backupPath, ';', fields, fieldCount, lineFn, contex
t, pErrorCode); | 98 u_parseDelimitedFile(backupPath, ';', fields, fieldCount, lineFn, contex
t, pErrorCode); |
99 } | 99 } |
100 if(U_FAILURE(*pErrorCode)) { | 100 if(U_FAILURE(*pErrorCode)) { |
101 log_err_status(*pErrorCode, "error parsing %s: %s\n", filename, u_errorN
ame(*pErrorCode)); | 101 log_err_status(*pErrorCode, "error parsing %s: %s\n", filename, u_errorN
ame(*pErrorCode)); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 /* test data ---------------------------------------------------------------- */ | 105 /* test data ---------------------------------------------------------------- */ |
106 | 106 |
107 static const UChar LAST_CHAR_CODE_IN_FILE = 0xFFFD; | |
108 static const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPe
PoSmScSkSoPiPf"; | 107 static const char tagStrings[] = "MnMcMeNdNlNoZsZlZpCcCfCsCoCnLuLlLtLmLoPcPdPsPe
PoSmScSkSoPiPf"; |
109 static const int32_t tagValues[] = | 108 static const int32_t tagValues[] = |
110 { | 109 { |
111 /* Mn */ U_NON_SPACING_MARK, | 110 /* Mn */ U_NON_SPACING_MARK, |
112 /* Mc */ U_COMBINING_SPACING_MARK, | 111 /* Mc */ U_COMBINING_SPACING_MARK, |
113 /* Me */ U_ENCLOSING_MARK, | 112 /* Me */ U_ENCLOSING_MARK, |
114 /* Nd */ U_DECIMAL_DIGIT_NUMBER, | 113 /* Nd */ U_DECIMAL_DIGIT_NUMBER, |
115 /* Nl */ U_LETTER_NUMBER, | 114 /* Nl */ U_LETTER_NUMBER, |
116 /* No */ U_OTHER_NUMBER, | 115 /* No */ U_OTHER_NUMBER, |
117 /* Zs */ U_SPACE_SEPARATOR, | 116 /* Zs */ U_SPACE_SEPARATOR, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 addTest(root, &TestUnicodeData, "tsutil/cucdtst/TestUnicodeData"); | 177 addTest(root, &TestUnicodeData, "tsutil/cucdtst/TestUnicodeData"); |
179 addTest(root, &TestAdditionalProperties, "tsutil/cucdtst/TestAdditionalPrope
rties"); | 178 addTest(root, &TestAdditionalProperties, "tsutil/cucdtst/TestAdditionalPrope
rties"); |
180 addTest(root, &TestNumericProperties, "tsutil/cucdtst/TestNumericProperties"
); | 179 addTest(root, &TestNumericProperties, "tsutil/cucdtst/TestNumericProperties"
); |
181 addTest(root, &TestUpperLower, "tsutil/cucdtst/TestUpperLower"); | 180 addTest(root, &TestUpperLower, "tsutil/cucdtst/TestUpperLower"); |
182 addTest(root, &TestLetterNumber, "tsutil/cucdtst/TestLetterNumber"); | 181 addTest(root, &TestLetterNumber, "tsutil/cucdtst/TestLetterNumber"); |
183 addTest(root, &TestMisc, "tsutil/cucdtst/TestMisc"); | 182 addTest(root, &TestMisc, "tsutil/cucdtst/TestMisc"); |
184 addTest(root, &TestPOSIX, "tsutil/cucdtst/TestPOSIX"); | 183 addTest(root, &TestPOSIX, "tsutil/cucdtst/TestPOSIX"); |
185 addTest(root, &TestControlPrint, "tsutil/cucdtst/TestControlPrint"); | 184 addTest(root, &TestControlPrint, "tsutil/cucdtst/TestControlPrint"); |
186 addTest(root, &TestIdentifier, "tsutil/cucdtst/TestIdentifier"); | 185 addTest(root, &TestIdentifier, "tsutil/cucdtst/TestIdentifier"); |
187 addTest(root, &TestCharNames, "tsutil/cucdtst/TestCharNames"); | 186 addTest(root, &TestCharNames, "tsutil/cucdtst/TestCharNames"); |
| 187 addTest(root, &TestUCharFromNameUnderflow, "tsutil/cucdtst/TestUCharFromName
Underflow"); |
188 addTest(root, &TestMirroring, "tsutil/cucdtst/TestMirroring"); | 188 addTest(root, &TestMirroring, "tsutil/cucdtst/TestMirroring"); |
189 addTest(root, &TestUScriptCodeAPI, "tsutil/cucdtst/TestUScriptCodeAPI"); | 189 addTest(root, &TestUScriptCodeAPI, "tsutil/cucdtst/TestUScriptCodeAPI"); |
190 addTest(root, &TestHasScript, "tsutil/cucdtst/TestHasScript"); | 190 addTest(root, &TestHasScript, "tsutil/cucdtst/TestHasScript"); |
191 addTest(root, &TestGetScriptExtensions, "tsutil/cucdtst/TestGetScriptExtensi
ons"); | 191 addTest(root, &TestGetScriptExtensions, "tsutil/cucdtst/TestGetScriptExtensi
ons"); |
192 addTest(root, &TestScriptMetadataAPI, "tsutil/cucdtst/TestScriptMetadataAPI"
); | 192 addTest(root, &TestScriptMetadataAPI, "tsutil/cucdtst/TestScriptMetadataAPI"
); |
193 addTest(root, &TestUScriptRunAPI, "tsutil/cucdtst/TestUScriptRunAPI"); | 193 addTest(root, &TestUScriptRunAPI, "tsutil/cucdtst/TestUScriptRunAPI"); |
194 addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames"); | 194 addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames"); |
195 addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues"); | 195 addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues"); |
196 addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency"); | 196 addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency"); |
197 addTest(root, &TestUCase, "tsutil/cucdtst/TestUCase"); | 197 addTest(root, &TestUCase, "tsutil/cucdtst/TestUCase"); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 static const int32_t sampleDigitValues[] = {0, 2, 3, 5}; | 553 static const int32_t sampleDigitValues[] = {0, 2, 3, 5}; |
554 | 554 |
555 uint32_t mask; | 555 uint32_t mask; |
556 | 556 |
557 int32_t i; | 557 int32_t i; |
558 char icuVersion[U_MAX_VERSION_STRING_LENGTH]; | 558 char icuVersion[U_MAX_VERSION_STRING_LENGTH]; |
559 UVersionInfo realVersion; | 559 UVersionInfo realVersion; |
560 | 560 |
561 memset(icuVersion, 0, U_MAX_VERSION_STRING_LENGTH); | 561 memset(icuVersion, 0, U_MAX_VERSION_STRING_LENGTH); |
562 | 562 |
563 testSampleCharProps(u_isspace, "u_isspace", sampleSpaces, LENGTHOF(sampleSpa
ces), TRUE); | 563 testSampleCharProps(u_isspace, "u_isspace", sampleSpaces, UPRV_LENGTHOF(samp
leSpaces), TRUE); |
564 testSampleCharProps(u_isspace, "u_isspace", sampleNonSpaces, LENGTHOF(sample
NonSpaces), FALSE); | 564 testSampleCharProps(u_isspace, "u_isspace", sampleNonSpaces, UPRV_LENGTHOF(s
ampleNonSpaces), FALSE); |
565 | 565 |
566 testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar", | 566 testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar", |
567 sampleSpaces, LENGTHOF(sampleSpaces), TRUE); | 567 sampleSpaces, UPRV_LENGTHOF(sampleSpaces), TRUE); |
568 testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar", | 568 testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar", |
569 sampleNonSpaces, LENGTHOF(sampleNonSpaces), FALSE); | 569 sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), FALSE); |
570 | 570 |
571 testSampleCharProps(u_isWhitespace, "u_isWhitespace", | 571 testSampleCharProps(u_isWhitespace, "u_isWhitespace", |
572 sampleWhiteSpaces, LENGTHOF(sampleWhiteSpaces), TRUE); | 572 sampleWhiteSpaces, UPRV_LENGTHOF(sampleWhiteSpaces), TRU
E); |
573 testSampleCharProps(u_isWhitespace, "u_isWhitespace", | 573 testSampleCharProps(u_isWhitespace, "u_isWhitespace", |
574 sampleNonWhiteSpaces, LENGTHOF(sampleNonWhiteSpaces), FA
LSE); | 574 sampleNonWhiteSpaces, UPRV_LENGTHOF(sampleNonWhiteSpaces
), FALSE); |
575 | 575 |
576 testSampleCharProps(u_isdefined, "u_isdefined", | 576 testSampleCharProps(u_isdefined, "u_isdefined", |
577 sampleDefined, LENGTHOF(sampleDefined), TRUE); | 577 sampleDefined, UPRV_LENGTHOF(sampleDefined), TRUE); |
578 testSampleCharProps(u_isdefined, "u_isdefined", | 578 testSampleCharProps(u_isdefined, "u_isdefined", |
579 sampleUndefined, LENGTHOF(sampleUndefined), FALSE); | 579 sampleUndefined, UPRV_LENGTHOF(sampleUndefined), FALSE); |
580 | 580 |
581 testSampleCharProps(u_isbase, "u_isbase", sampleBase, LENGTHOF(sampleBase),
TRUE); | 581 testSampleCharProps(u_isbase, "u_isbase", sampleBase, UPRV_LENGTHOF(sampleBa
se), TRUE); |
582 testSampleCharProps(u_isbase, "u_isbase", sampleNonBase, LENGTHOF(sampleNonB
ase), FALSE); | 582 testSampleCharProps(u_isbase, "u_isbase", sampleNonBase, UPRV_LENGTHOF(sampl
eNonBase), FALSE); |
583 | 583 |
584 testSampleCharProps(u_isdigit, "u_isdigit", sampleDigits, LENGTHOF(sampleDig
its), TRUE); | 584 testSampleCharProps(u_isdigit, "u_isdigit", sampleDigits, UPRV_LENGTHOF(samp
leDigits), TRUE); |
585 testSampleCharProps(u_isdigit, "u_isdigit", sampleNonDigits, LENGTHOF(sample
NonDigits), FALSE); | 585 testSampleCharProps(u_isdigit, "u_isdigit", sampleNonDigits, UPRV_LENGTHOF(s
ampleNonDigits), FALSE); |
586 | 586 |
587 for (i = 0; i < LENGTHOF(sampleDigits); i++) { | 587 for (i = 0; i < UPRV_LENGTHOF(sampleDigits); i++) { |
588 if (u_charDigitValue(sampleDigits[i]) != sampleDigitValues[i]) { | 588 if (u_charDigitValue(sampleDigits[i]) != sampleDigitValues[i]) { |
589 log_err("error: u_charDigitValue(U+04x)=%d != %d\n", | 589 log_err("error: u_charDigitValue(U+04x)=%d != %d\n", |
590 sampleDigits[i], u_charDigitValue(sampleDigits[i]), sampleDi
gitValues[i]); | 590 sampleDigits[i], u_charDigitValue(sampleDigits[i]), sampleDi
gitValues[i]); |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 /* Tests the ICU version #*/ | 594 /* Tests the ICU version #*/ |
595 u_getVersion(realVersion); | 595 u_getVersion(realVersion); |
596 u_versionToString(realVersion, icuVersion); | 596 u_versionToString(realVersion, icuVersion); |
597 if (strncmp(icuVersion, U_ICU_VERSION, uprv_min((int32_t)strlen(icuVersion),
(int32_t)strlen(U_ICU_VERSION))) != 0) | 597 if (strncmp(icuVersion, U_ICU_VERSION, uprv_min((int32_t)strlen(icuVersion),
(int32_t)strlen(U_ICU_VERSION))) != 0) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 { 0x5a, 36, 35 }, | 715 { 0x5a, 36, 35 }, |
716 { 0x7a, 36, 35 }, | 716 { 0x7a, 36, 35 }, |
717 { 0xff3a, 36, 35 }, | 717 { 0xff3a, 36, 35 }, |
718 { 0xff5a, 36, 35 }, | 718 { 0xff5a, 36, 35 }, |
719 | 719 |
720 /* wrong radix values */ | 720 /* wrong radix values */ |
721 { 0x0031, 1, -1 }, | 721 { 0x0031, 1, -1 }, |
722 { 0xff3a, 37, -1 } | 722 { 0xff3a, 37, -1 } |
723 }; | 723 }; |
724 | 724 |
725 for(i=0; i<LENGTHOF(data); ++i) { | 725 for(i=0; i<UPRV_LENGTHOF(data); ++i) { |
726 if(u_digit(data[i].c, data[i].radix)!=data[i].value) { | 726 if(u_digit(data[i].c, data[i].radix)!=data[i].value) { |
727 log_err("u_digit(U+%04x, %d)=%d expected %d\n", | 727 log_err("u_digit(U+%04x, %d)=%d expected %d\n", |
728 data[i].c, | 728 data[i].c, |
729 data[i].radix, | 729 data[i].radix, |
730 u_digit(data[i].c, data[i].radix), | 730 u_digit(data[i].c, data[i].radix), |
731 data[i].value); | 731 data[i].value); |
732 } | 732 } |
733 } | 733 } |
734 } | 734 } |
735 } | 735 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 }; | 816 }; |
817 | 817 |
818 static void | 818 static void |
819 TestPOSIX() { | 819 TestPOSIX() { |
820 uint32_t mask; | 820 uint32_t mask; |
821 int32_t cl, i; | 821 int32_t cl, i; |
822 UBool expect; | 822 UBool expect; |
823 | 823 |
824 mask=1; | 824 mask=1; |
825 for(cl=0; cl<12; ++cl) { | 825 for(cl=0; cl<12; ++cl) { |
826 for(i=0; i<LENGTHOF(posixData); ++i) { | 826 for(i=0; i<UPRV_LENGTHOF(posixData); ++i) { |
827 expect=(UBool)((posixData[i].posixResults&mask)!=0); | 827 expect=(UBool)((posixData[i].posixResults&mask)!=0); |
828 if(posixClasses[cl].fn(posixData[i].c)!=expect) { | 828 if(posixClasses[cl].fn(posixData[i].c)!=expect) { |
829 log_err("u_%s(U+%04x)=%s is wrong\n", | 829 log_err("u_%s(U+%04x)=%s is wrong\n", |
830 posixClasses[cl].name, posixData[i].c, expect ? "FALSE" : "T
RUE"); | 830 posixClasses[cl].name, posixData[i].c, expect ? "FALSE" : "T
RUE"); |
831 } | 831 } |
832 } | 832 } |
833 mask<<=1; | 833 mask<<=1; |
834 } | 834 } |
835 } | 835 } |
836 | 836 |
837 /* Tests for isControl(u_iscntrl()) and isPrintable(u_isprint()) */ | 837 /* Tests for isControl(u_iscntrl()) and isPrintable(u_isprint()) */ |
838 static void TestControlPrint() | 838 static void TestControlPrint() |
839 { | 839 { |
840 const UChar32 sampleControl[] = {0x1b, 0x97, 0x82, 0x2028, 0x2029, 0x200c, 0
x202b}; | 840 const UChar32 sampleControl[] = {0x1b, 0x97, 0x82, 0x2028, 0x2029, 0x200c, 0
x202b}; |
841 const UChar32 sampleNonControl[] = {0x61, 0x0031, 0x00e2}; | 841 const UChar32 sampleNonControl[] = {0x61, 0x0031, 0x00e2}; |
842 const UChar32 samplePrintable[] = {0x0042, 0x005f, 0x2014}; | 842 const UChar32 samplePrintable[] = {0x0042, 0x005f, 0x2014}; |
843 const UChar32 sampleNonPrintable[] = {0x200c, 0x009f, 0x001b}; | 843 const UChar32 sampleNonPrintable[] = {0x200c, 0x009f, 0x001b}; |
844 UChar32 c; | 844 UChar32 c; |
845 | 845 |
846 testSampleCharProps(u_iscntrl, "u_iscntrl", sampleControl, LENGTHOF(sampleCo
ntrol), TRUE); | 846 testSampleCharProps(u_iscntrl, "u_iscntrl", sampleControl, UPRV_LENGTHOF(sam
pleControl), TRUE); |
847 testSampleCharProps(u_iscntrl, "u_iscntrl", sampleNonControl, LENGTHOF(sampl
eNonControl), FALSE); | 847 testSampleCharProps(u_iscntrl, "u_iscntrl", sampleNonControl, UPRV_LENGTHOF(
sampleNonControl), FALSE); |
848 | 848 |
849 testSampleCharProps(u_isprint, "u_isprint", | 849 testSampleCharProps(u_isprint, "u_isprint", |
850 samplePrintable, LENGTHOF(samplePrintable), TRUE); | 850 samplePrintable, UPRV_LENGTHOF(samplePrintable), TRUE); |
851 testSampleCharProps(u_isprint, "u_isprint", | 851 testSampleCharProps(u_isprint, "u_isprint", |
852 sampleNonPrintable, LENGTHOF(sampleNonPrintable), FALSE)
; | 852 sampleNonPrintable, UPRV_LENGTHOF(sampleNonPrintable), F
ALSE); |
853 | 853 |
854 /* test all ISO 8 controls */ | 854 /* test all ISO 8 controls */ |
855 for(c=0; c<=0x9f; ++c) { | 855 for(c=0; c<=0x9f; ++c) { |
856 if(c==0x20) { | 856 if(c==0x20) { |
857 /* skip ASCII graphic characters and continue with DEL */ | 857 /* skip ASCII graphic characters and continue with DEL */ |
858 c=0x7f; | 858 c=0x7f; |
859 } | 859 } |
860 if(!u_iscntrl(c)) { | 860 if(!u_iscntrl(c)) { |
861 log_err("error: u_iscntrl(ISO 8 control U+%04x)=FALSE\n", c); | 861 log_err("error: u_iscntrl(ISO 8 control U+%04x)=FALSE\n", c); |
862 } | 862 } |
(...skipping 27 matching lines...) Expand all Loading... |
890 const UChar32 sampleJavaIDPart[] = {0x005f, 0x0032, 0x0045}; | 890 const UChar32 sampleJavaIDPart[] = {0x005f, 0x0032, 0x0045}; |
891 const UChar32 sampleNonJavaIDPart[] = {0x2030, 0x2020, 0x0020}; | 891 const UChar32 sampleNonJavaIDPart[] = {0x2030, 0x2020, 0x0020}; |
892 const UChar32 sampleUnicodeIDStart[] = {0x0250, 0x00e2, 0x0061}; | 892 const UChar32 sampleUnicodeIDStart[] = {0x0250, 0x00e2, 0x0061}; |
893 const UChar32 sampleNonUnicodeIDStart[] = {0x2000, 0x000a, 0x2019}; | 893 const UChar32 sampleNonUnicodeIDStart[] = {0x2000, 0x000a, 0x2019}; |
894 const UChar32 sampleUnicodeIDPart[] = {0x005f, 0x0032, 0x0045}; | 894 const UChar32 sampleUnicodeIDPart[] = {0x005f, 0x0032, 0x0045}; |
895 const UChar32 sampleNonUnicodeIDPart[] = {0x2030, 0x00a3, 0x0020}; | 895 const UChar32 sampleNonUnicodeIDPart[] = {0x2030, 0x00a3, 0x0020}; |
896 const UChar32 sampleIDIgnore[] = {0x0006, 0x0010, 0x206b, 0x85}; | 896 const UChar32 sampleIDIgnore[] = {0x0006, 0x0010, 0x206b, 0x85}; |
897 const UChar32 sampleNonIDIgnore[] = {0x0075, 0x00a3, 0x0061}; | 897 const UChar32 sampleNonIDIgnore[] = {0x0075, 0x00a3, 0x0061}; |
898 | 898 |
899 testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart", | 899 testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart", |
900 sampleJavaIDStart, LENGTHOF(sampleJavaIDStart), TRUE); | 900 sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), TRU
E); |
901 testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart", | 901 testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart", |
902 sampleNonJavaIDStart, LENGTHOF(sampleNonJavaIDStart), FA
LSE); | 902 sampleNonJavaIDStart, UPRV_LENGTHOF(sampleNonJavaIDStart
), FALSE); |
903 | 903 |
904 testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart", | 904 testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart", |
905 sampleJavaIDPart, LENGTHOF(sampleJavaIDPart), TRUE); | 905 sampleJavaIDPart, UPRV_LENGTHOF(sampleJavaIDPart), TRUE)
; |
906 testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart", | 906 testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart", |
907 sampleNonJavaIDPart, LENGTHOF(sampleNonJavaIDPart), FALS
E); | 907 sampleNonJavaIDPart, UPRV_LENGTHOF(sampleNonJavaIDPart),
FALSE); |
908 | 908 |
909 /* IDPart should imply IDStart */ | 909 /* IDPart should imply IDStart */ |
910 testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart", | 910 testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart", |
911 sampleJavaIDStart, LENGTHOF(sampleJavaIDStart), TRUE); | 911 sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), TRU
E); |
912 | 912 |
913 testSampleCharProps(u_isIDStart, "u_isIDStart", | 913 testSampleCharProps(u_isIDStart, "u_isIDStart", |
914 sampleUnicodeIDStart, LENGTHOF(sampleUnicodeIDStart), TR
UE); | 914 sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart
), TRUE); |
915 testSampleCharProps(u_isIDStart, "u_isIDStart", | 915 testSampleCharProps(u_isIDStart, "u_isIDStart", |
916 sampleNonUnicodeIDStart, LENGTHOF(sampleNonUnicodeIDStar
t), FALSE); | 916 sampleNonUnicodeIDStart, UPRV_LENGTHOF(sampleNonUnicodeI
DStart), FALSE); |
917 | 917 |
918 testSampleCharProps(u_isIDPart, "u_isIDPart", | 918 testSampleCharProps(u_isIDPart, "u_isIDPart", |
919 sampleUnicodeIDPart, LENGTHOF(sampleUnicodeIDPart), TRUE
); | 919 sampleUnicodeIDPart, UPRV_LENGTHOF(sampleUnicodeIDPart),
TRUE); |
920 testSampleCharProps(u_isIDPart, "u_isIDPart", | 920 testSampleCharProps(u_isIDPart, "u_isIDPart", |
921 sampleNonUnicodeIDPart, LENGTHOF(sampleNonUnicodeIDPart)
, FALSE); | 921 sampleNonUnicodeIDPart, UPRV_LENGTHOF(sampleNonUnicodeID
Part), FALSE); |
922 | 922 |
923 /* IDPart should imply IDStart */ | 923 /* IDPart should imply IDStart */ |
924 testSampleCharProps(u_isIDPart, "u_isIDPart", | 924 testSampleCharProps(u_isIDPart, "u_isIDPart", |
925 sampleUnicodeIDStart, LENGTHOF(sampleUnicodeIDStart), TR
UE); | 925 sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart
), TRUE); |
926 | 926 |
927 testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable", | 927 testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable", |
928 sampleIDIgnore, LENGTHOF(sampleIDIgnore), TRUE); | 928 sampleIDIgnore, UPRV_LENGTHOF(sampleIDIgnore), TRUE); |
929 testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable", | 929 testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable", |
930 sampleNonIDIgnore, LENGTHOF(sampleNonIDIgnore), FALSE); | 930 sampleNonIDIgnore, UPRV_LENGTHOF(sampleNonIDIgnore), FAL
SE); |
931 } | 931 } |
932 | 932 |
933 /* for each line of UnicodeData.txt, check some of the properties */ | 933 /* for each line of UnicodeData.txt, check some of the properties */ |
934 typedef struct UnicodeDataContext { | 934 typedef struct UnicodeDataContext { |
935 #if UCONFIG_NO_NORMALIZATION | 935 #if UCONFIG_NO_NORMALIZATION |
936 const void *dummy; | 936 const void *dummy; |
937 #else | 937 #else |
938 const UNormalizer2 *nfc; | 938 const UNormalizer2 *nfc; |
939 const UNormalizer2 *nfkc; | 939 const UNormalizer2 *nfkc; |
940 #endif | 940 #endif |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 {0xeffff, U_UNASSIGNED} | 1182 {0xeffff, U_UNASSIGNED} |
1183 }; | 1183 }; |
1184 | 1184 |
1185 int32_t i, count; | 1185 int32_t i, count; |
1186 | 1186 |
1187 if(0!=strcmp((const char *)context, "a1")) { | 1187 if(0!=strcmp((const char *)context, "a1")) { |
1188 log_err("error: u_enumCharTypes() passes on an incorrect context pointer
\n"); | 1188 log_err("error: u_enumCharTypes() passes on an incorrect context pointer
\n"); |
1189 return FALSE; | 1189 return FALSE; |
1190 } | 1190 } |
1191 | 1191 |
1192 count=LENGTHOF(test); | 1192 count=UPRV_LENGTHOF(test); |
1193 for(i=0; i<count; ++i) { | 1193 for(i=0; i<count; ++i) { |
1194 if(start<=test[i][0] && test[i][0]<limit) { | 1194 if(start<=test[i][0] && test[i][0]<limit) { |
1195 if(type!=(UCharCategory)test[i][1]) { | 1195 if(type!=(UCharCategory)test[i][1]) { |
1196 log_err("error: u_enumCharTypes() has range [U+%04lx, U+%04lx[ w
ith %ld instead of U+%04lx with %ld\n", | 1196 log_err("error: u_enumCharTypes() has range [U+%04lx, U+%04lx[ w
ith %ld instead of U+%04lx with %ld\n", |
1197 start, limit, (long)type, test[i][0], test[i][1]); | 1197 start, limit, (long)type, test[i][0], test[i][1]); |
1198 } | 1198 } |
1199 /* stop at the range that includes the last test code point (increas
es code coverage for enumeration) */ | 1199 /* stop at the range that includes the last test code point (increas
es code coverage for enumeration) */ |
1200 return i==(count-1) ? FALSE : TRUE; | 1200 return i==(count-1) ? FALSE : TRUE; |
1201 } | 1201 } |
1202 } | 1202 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 * Unicode 4.0.1/Public Review Issue #28 (http://www.unicode.org/review/reso
lved-pri.html) | 1271 * Unicode 4.0.1/Public Review Issue #28 (http://www.unicode.org/review/reso
lved-pri.html) |
1272 * changed some default values. | 1272 * changed some default values. |
1273 * In particular, non-characters and unassigned Default Ignorable Code Point
s | 1273 * In particular, non-characters and unassigned Default Ignorable Code Point
s |
1274 * change from L to BN. | 1274 * change from L to BN. |
1275 * | 1275 * |
1276 * UCD.html version 4.0.1 does not yet reflect these changes. | 1276 * UCD.html version 4.0.1 does not yet reflect these changes. |
1277 */ | 1277 */ |
1278 if(type==U_UNASSIGNED || type==U_PRIVATE_USE_CHAR) { | 1278 if(type==U_UNASSIGNED || type==U_PRIVATE_USE_CHAR) { |
1279 /* enumerate the intersections of defaultBidi ranges with [start..limit[
*/ | 1279 /* enumerate the intersections of defaultBidi ranges with [start..limit[
*/ |
1280 c=start; | 1280 c=start; |
1281 for(i=0; i<LENGTHOF(defaultBidi) && c<limit; ++i) { | 1281 for(i=0; i<UPRV_LENGTHOF(defaultBidi) && c<limit; ++i) { |
1282 if((int32_t)c<defaultBidi[i][0]) { | 1282 if((int32_t)c<defaultBidi[i][0]) { |
1283 while(c<limit && (int32_t)c<defaultBidi[i][0]) { | 1283 while(c<limit && (int32_t)c<defaultBidi[i][0]) { |
1284 if(U_IS_UNICODE_NONCHAR(c) || u_hasBinaryProperty(c, UCHAR_D
EFAULT_IGNORABLE_CODE_POINT)) { | 1284 if(U_IS_UNICODE_NONCHAR(c) || u_hasBinaryProperty(c, UCHAR_D
EFAULT_IGNORABLE_CODE_POINT)) { |
1285 shouldBeDir=U_BOUNDARY_NEUTRAL; | 1285 shouldBeDir=U_BOUNDARY_NEUTRAL; |
1286 } else { | 1286 } else { |
1287 shouldBeDir=(UCharDirection)defaultBidi[i][1]; | 1287 shouldBeDir=(UCharDirection)defaultBidi[i][1]; |
1288 } | 1288 } |
1289 | 1289 |
1290 if( u_charDirection(c)!=shouldBeDir || | 1290 if( u_charDirection(c)!=shouldBeDir || |
1291 u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=shouldBeDir | 1291 u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=shouldBeDir |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 log_verbose("Ok: uprv_getCharNameCharacters() returned %s\n", aescst
rdup(pat, l1)); | 1932 log_verbose("Ok: uprv_getCharNameCharacters() returned %s\n", aescst
rdup(pat, l1)); |
1933 } | 1933 } |
1934 | 1934 |
1935 uset_close(set); | 1935 uset_close(set); |
1936 uset_close(dumb); | 1936 uset_close(dumb); |
1937 } | 1937 } |
1938 | 1938 |
1939 /* ### TODO: test error cases and other interesting things */ | 1939 /* ### TODO: test error cases and other interesting things */ |
1940 } | 1940 } |
1941 | 1941 |
| 1942 static void |
| 1943 TestUCharFromNameUnderflow() { |
| 1944 // Ticket #10889: Underflow crash when there is no dash. |
| 1945 UErrorCode errorCode=U_ZERO_ERROR; |
| 1946 UChar32 c=u_charFromName(U_EXTENDED_CHAR_NAME, "<NO BREAK SPACE>", &errorCod
e); |
| 1947 if(U_SUCCESS(errorCode)) { |
| 1948 log_err("u_charFromName(<NO BREAK SPACE>) = U+%04x but should fail - %s\
n", c, u_errorName(errorCode)); |
| 1949 } |
| 1950 |
| 1951 // Test related edge cases. |
| 1952 errorCode=U_ZERO_ERROR; |
| 1953 c=u_charFromName(U_EXTENDED_CHAR_NAME, "<-00a0>", &errorCode); |
| 1954 if(U_SUCCESS(errorCode)) { |
| 1955 log_err("u_charFromName(<-00a0>) = U+%04x but should fail - %s\n", c, u_
errorName(errorCode)); |
| 1956 } |
| 1957 |
| 1958 errorCode=U_ZERO_ERROR; |
| 1959 c=u_charFromName(U_EXTENDED_CHAR_NAME, "<control->", &errorCode); |
| 1960 if(U_SUCCESS(errorCode)) { |
| 1961 log_err("u_charFromName(<control->) = U+%04x but should fail - %s\n", c,
u_errorName(errorCode)); |
| 1962 } |
| 1963 |
| 1964 errorCode=U_ZERO_ERROR; |
| 1965 c=u_charFromName(U_EXTENDED_CHAR_NAME, "<control-111111>", &errorCode); |
| 1966 if(U_SUCCESS(errorCode)) { |
| 1967 log_err("u_charFromName(<control-111111>) = U+%04x but should fail - %s\
n", c, u_errorName(errorCode)); |
| 1968 } |
| 1969 } |
| 1970 |
1942 /* test u_isMirrored() and u_charMirror() ----------------------------------- */ | 1971 /* test u_isMirrored() and u_charMirror() ----------------------------------- */ |
1943 | 1972 |
1944 static void | 1973 static void |
1945 TestMirroring() { | 1974 TestMirroring() { |
1946 USet *set; | 1975 USet *set; |
1947 UErrorCode errorCode; | 1976 UErrorCode errorCode; |
1948 | 1977 |
1949 UChar32 start, end, c2, c3; | 1978 UChar32 start, end, c2, c3; |
1950 int32_t i; | 1979 int32_t i; |
1951 | 1980 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 }; | 2099 }; |
2071 | 2100 |
2072 static const RunTestData testData2[] = { | 2101 static const RunTestData testData2[] = { |
2073 {"((((((((((abc))))))))))", USCRIPT_LATIN} | 2102 {"((((((((((abc))))))))))", USCRIPT_LATIN} |
2074 }; | 2103 }; |
2075 | 2104 |
2076 static const struct { | 2105 static const struct { |
2077 const RunTestData *testData; | 2106 const RunTestData *testData; |
2078 int32_t nRuns; | 2107 int32_t nRuns; |
2079 } testDataEntries[] = { | 2108 } testDataEntries[] = { |
2080 {testData1, LENGTHOF(testData1)}, | 2109 {testData1, UPRV_LENGTHOF(testData1)}, |
2081 {testData2, LENGTHOF(testData2)} | 2110 {testData2, UPRV_LENGTHOF(testData2)} |
2082 }; | 2111 }; |
2083 | 2112 |
2084 static const int32_t nTestEntries = LENGTHOF(testDataEntries); | 2113 static const int32_t nTestEntries = UPRV_LENGTHOF(testDataEntries); |
2085 int32_t testEntry; | 2114 int32_t testEntry; |
2086 | 2115 |
2087 for (testEntry = 0; testEntry < nTestEntries; testEntry += 1) { | 2116 for (testEntry = 0; testEntry < nTestEntries; testEntry += 1) { |
2088 UChar testString[1024]; | 2117 UChar testString[1024]; |
2089 int32_t runStarts[256]; | 2118 int32_t runStarts[256]; |
2090 int32_t nTestRuns = testDataEntries[testEntry].nRuns; | 2119 int32_t nTestRuns = testDataEntries[testEntry].nRuns; |
2091 const RunTestData *testData = testDataEntries[testEntry].testData; | 2120 const RunTestData *testData = testDataEntries[testEntry].testData; |
2092 | 2121 |
2093 int32_t run, stringLimit; | 2122 int32_t run, stringLimit; |
2094 UScriptRun *scriptRun = NULL; | 2123 UScriptRun *scriptRun = NULL; |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2419 { 0x05ed, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2448 { 0x05ed, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2420 { 0x07f2, UCHAR_BIDI_CLASS, U_DIR_NON_SPACING_MARK }, /* Nko, new in Uni
code 5.0 */ | 2449 { 0x07f2, UCHAR_BIDI_CLASS, U_DIR_NON_SPACING_MARK }, /* Nko, new in Uni
code 5.0 */ |
2421 { 0x07fe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, /* unassigned R */ | 2450 { 0x07fe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, /* unassigned R */ |
2422 { 0x089f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2451 { 0x089f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2423 { 0xfb37, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2452 { 0xfb37, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2424 { 0xfb42, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2453 { 0xfb42, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2425 { 0x10806, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2454 { 0x10806, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2426 { 0x10909, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2455 { 0x10909, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2427 { 0x10fe4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, | 2456 { 0x10fe4, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT }, |
2428 | 2457 |
2429 { 0x0605, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2458 { 0x061d, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2430 { 0x061c, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | |
2431 { 0x063f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2459 { 0x063f, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2432 { 0x070e, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2460 { 0x070e, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2433 { 0x0775, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2461 { 0x0775, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2434 { 0xfbc2, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2462 { 0xfbc2, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2435 { 0xfd90, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2463 { 0xfd90, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2436 { 0xfefe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, | 2464 { 0xfefe, UCHAR_BIDI_CLASS, U_RIGHT_TO_LEFT_ARABIC }, |
2437 | 2465 |
2438 { 0x02AF, UCHAR_BLOCK, UBLOCK_IPA_EXTENSIONS }, | 2466 { 0x02AF, UCHAR_BLOCK, UBLOCK_IPA_EXTENSIONS }, |
2439 { 0x0C4E, UCHAR_BLOCK, UBLOCK_TELUGU }, | 2467 { 0x0C4E, UCHAR_BLOCK, UBLOCK_TELUGU }, |
2440 { 0x155A, UCHAR_BLOCK, UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS }, | 2468 { 0x155A, UCHAR_BLOCK, UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS }, |
2441 { 0x1717, UCHAR_BLOCK, UBLOCK_TAGALOG }, | 2469 { 0x1717, UCHAR_BLOCK, UBLOCK_TAGALOG }, |
2442 { 0x1900, UCHAR_BLOCK, UBLOCK_LIMBU }, | 2470 { 0x1900, UCHAR_BLOCK, UBLOCK_LIMBU }, |
2443 { 0x1AFF, UCHAR_BLOCK, UBLOCK_NO_BLOCK }, | 2471 { 0x1CBF, UCHAR_BLOCK, UBLOCK_NO_BLOCK }, |
2444 { 0x3040, UCHAR_BLOCK, UBLOCK_HIRAGANA }, | 2472 { 0x3040, UCHAR_BLOCK, UBLOCK_HIRAGANA }, |
2445 { 0x1D0FF, UCHAR_BLOCK, UBLOCK_BYZANTINE_MUSICAL_SYMBOLS }, | 2473 { 0x1D0FF, UCHAR_BLOCK, UBLOCK_BYZANTINE_MUSICAL_SYMBOLS }, |
2446 { 0x50000, UCHAR_BLOCK, UBLOCK_NO_BLOCK }, | 2474 { 0x50000, UCHAR_BLOCK, UBLOCK_NO_BLOCK }, |
2447 { 0xEFFFF, UCHAR_BLOCK, UBLOCK_NO_BLOCK }, | 2475 { 0xEFFFF, UCHAR_BLOCK, UBLOCK_NO_BLOCK }, |
2448 { 0x10D0FF, UCHAR_BLOCK, UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B }, | 2476 { 0x10D0FF, UCHAR_BLOCK, UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B }, |
2449 | 2477 |
2450 /* UCHAR_CANONICAL_COMBINING_CLASS tested for assigned characters in Tes
tUnicodeData() */ | 2478 /* UCHAR_CANONICAL_COMBINING_CLASS tested for assigned characters in Tes
tUnicodeData() */ |
2451 { 0xd7d7, UCHAR_CANONICAL_COMBINING_CLASS, 0 }, | 2479 { 0xd7d7, UCHAR_CANONICAL_COMBINING_CLASS, 0 }, |
2452 | 2480 |
2453 { 0x00A0, UCHAR_DECOMPOSITION_TYPE, U_DT_NOBREAK }, | 2481 { 0x00A0, UCHAR_DECOMPOSITION_TYPE, U_DT_NOBREAK }, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 { 0x20CF, UCHAR_BIDI_CLASS, U_EUROPEAN_NUMBER_TERMINATOR }, | 2669 { 0x20CF, UCHAR_BIDI_CLASS, U_EUROPEAN_NUMBER_TERMINATOR }, |
2642 | 2670 |
2643 /* new property in Unicode 6.3 */ | 2671 /* new property in Unicode 6.3 */ |
2644 { 0x0027, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE }, | 2672 { 0x0027, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE }, |
2645 { 0x0028, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN }, | 2673 { 0x0028, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN }, |
2646 { 0x0029, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE }, | 2674 { 0x0029, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE }, |
2647 { 0xFF5C, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE }, | 2675 { 0xFF5C, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_NONE }, |
2648 { 0xFF5B, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN }, | 2676 { 0xFF5B, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_OPEN }, |
2649 { 0xFF5D, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE }, | 2677 { 0xFF5D, UCHAR_BIDI_PAIRED_BRACKET_TYPE, U_BPT_CLOSE }, |
2650 | 2678 |
| 2679 { -1, 0x700, 0 }, /* version break for Unicode 7.0 */ |
| 2680 |
| 2681 /* new character range with Joining_Group values */ |
| 2682 { 0x10ABF, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP }, |
| 2683 { 0x10AC0, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_ALEPH }, |
| 2684 { 0x10AC1, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_BETH }, |
| 2685 { 0x10AEF, UCHAR_JOINING_GROUP, U_JG_MANICHAEAN_HUNDRED }, |
| 2686 { 0x10AF0, UCHAR_JOINING_GROUP, U_JG_NO_JOINING_GROUP }, |
| 2687 |
2651 /* undefined UProperty values */ | 2688 /* undefined UProperty values */ |
2652 { 0x61, 0x4a7, 0 }, | 2689 { 0x61, 0x4a7, 0 }, |
2653 { 0x234bc, 0x15ed, 0 } | 2690 { 0x234bc, 0x15ed, 0 } |
2654 }; | 2691 }; |
2655 | 2692 |
2656 UVersionInfo version; | 2693 UVersionInfo version; |
2657 UChar32 c; | 2694 UChar32 c; |
2658 int32_t i, result, uVersion; | 2695 int32_t i, result, uVersion; |
2659 UProperty which; | 2696 UProperty which; |
2660 | 2697 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2873 { 0x10301, U_NT_NONE, U_NO_NUMERIC_VALUE }, | 2910 { 0x10301, U_NT_NONE, U_NO_NUMERIC_VALUE }, |
2874 { 0xe0033, U_NT_NONE, U_NO_NUMERIC_VALUE }, | 2911 { 0xe0033, U_NT_NONE, U_NO_NUMERIC_VALUE }, |
2875 { 0x10ffff, U_NT_NONE, U_NO_NUMERIC_VALUE }, | 2912 { 0x10ffff, U_NT_NONE, U_NO_NUMERIC_VALUE }, |
2876 { 0x110000, U_NT_NONE, U_NO_NUMERIC_VALUE } | 2913 { 0x110000, U_NT_NONE, U_NO_NUMERIC_VALUE } |
2877 }; | 2914 }; |
2878 | 2915 |
2879 double nv; | 2916 double nv; |
2880 UChar32 c; | 2917 UChar32 c; |
2881 int32_t i, type; | 2918 int32_t i, type; |
2882 | 2919 |
2883 for(i=0; i<LENGTHOF(values); ++i) { | 2920 for(i=0; i<UPRV_LENGTHOF(values); ++i) { |
2884 c=values[i].c; | 2921 c=values[i].c; |
2885 type=u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE); | 2922 type=u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE); |
2886 nv=u_getNumericValue(c); | 2923 nv=u_getNumericValue(c); |
2887 | 2924 |
2888 if(type!=values[i].type) { | 2925 if(type!=values[i].type) { |
2889 log_err("UCHAR_NUMERIC_TYPE(U+%04lx)=%d should be %d\n", c, type, va
lues[i].type); | 2926 log_err("UCHAR_NUMERIC_TYPE(U+%04lx)=%d should be %d\n", c, type, va
lues[i].type); |
2890 } | 2927 } |
2891 if(0.000001 <= fabs(nv - values[i].numValue)) { | 2928 if(0.000001 <= fabs(nv - values[i].numValue)) { |
2892 log_err("u_getNumericValue(U+%04lx)=%g should be %g\n", c, nv, value
s[i].numValue); | 2929 log_err("u_getNumericValue(U+%04lx)=%g should be %g\n", c, nv, value
s[i].numValue); |
2893 } | 2930 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 int32_t i, length; | 3098 int32_t i, length; |
3062 | 3099 |
3063 U_STRING_DECL(hyphenPattern, "[:Hyphen:]", 10); | 3100 U_STRING_DECL(hyphenPattern, "[:Hyphen:]", 10); |
3064 U_STRING_DECL(dashPattern, "[:Dash:]", 8); | 3101 U_STRING_DECL(dashPattern, "[:Dash:]", 8); |
3065 U_STRING_DECL(lowerPattern, "[:Lowercase:]", 13); | 3102 U_STRING_DECL(lowerPattern, "[:Lowercase:]", 13); |
3066 U_STRING_DECL(formatPattern, "[:Cf:]", 6); | 3103 U_STRING_DECL(formatPattern, "[:Cf:]", 6); |
3067 U_STRING_DECL(alphaPattern, "[:Alphabetic:]", 14); | 3104 U_STRING_DECL(alphaPattern, "[:Alphabetic:]", 14); |
3068 | 3105 |
3069 U_STRING_DECL(mathBlocksPattern, | 3106 U_STRING_DECL(mathBlocksPattern, |
3070 "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Sym
bols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathe
matical Operators:][:block=Mathematical Alphanumeric Symbols:]]", | 3107 "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Sym
bols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathe
matical Operators:][:block=Mathematical Alphanumeric Symbols:]]", |
3071 1+32+46+46+45+43+1+1); /* +1 for NUL */ | 3108 214); |
3072 U_STRING_DECL(mathPattern, "[:Math:]", 8); | 3109 U_STRING_DECL(mathPattern, "[:Math:]", 8); |
3073 U_STRING_DECL(unassignedPattern, "[:Cn:]", 6); | 3110 U_STRING_DECL(unassignedPattern, "[:Cn:]", 6); |
3074 U_STRING_DECL(unknownPattern, "[:sc=Unknown:]", 14); | 3111 U_STRING_DECL(unknownPattern, "[:sc=Unknown:]", 14); |
3075 U_STRING_DECL(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20); | 3112 U_STRING_DECL(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20); |
3076 | 3113 |
3077 U_STRING_INIT(hyphenPattern, "[:Hyphen:]", 10); | 3114 U_STRING_INIT(hyphenPattern, "[:Hyphen:]", 10); |
3078 U_STRING_INIT(dashPattern, "[:Dash:]", 8); | 3115 U_STRING_INIT(dashPattern, "[:Dash:]", 8); |
3079 U_STRING_INIT(lowerPattern, "[:Lowercase:]", 13); | 3116 U_STRING_INIT(lowerPattern, "[:Lowercase:]", 13); |
3080 U_STRING_INIT(formatPattern, "[:Cf:]", 6); | 3117 U_STRING_INIT(formatPattern, "[:Cf:]", 6); |
3081 U_STRING_INIT(alphaPattern, "[:Alphabetic:]", 14); | 3118 U_STRING_INIT(alphaPattern, "[:Alphabetic:]", 14); |
3082 | 3119 |
3083 U_STRING_INIT(mathBlocksPattern, | 3120 U_STRING_INIT(mathBlocksPattern, |
3084 "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Sym
bols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathe
matical Operators:][:block=Mathematical Alphanumeric Symbols:]]", | 3121 "[[:block=Mathematical Operators:][:block=Miscellaneous Mathematical Sym
bols-A:][:block=Miscellaneous Mathematical Symbols-B:][:block=Supplemental Mathe
matical Operators:][:block=Mathematical Alphanumeric Symbols:]]", |
3085 1+32+46+46+45+43+1+1); /* +1 for NUL */ | 3122 214); |
3086 U_STRING_INIT(mathPattern, "[:Math:]", 8); | 3123 U_STRING_INIT(mathPattern, "[:Math:]", 8); |
3087 U_STRING_INIT(unassignedPattern, "[:Cn:]", 6); | 3124 U_STRING_INIT(unassignedPattern, "[:Cn:]", 6); |
3088 U_STRING_INIT(unknownPattern, "[:sc=Unknown:]", 14); | 3125 U_STRING_INIT(unknownPattern, "[:sc=Unknown:]", 14); |
3089 U_STRING_INIT(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20); | 3126 U_STRING_INIT(reservedPattern, "[[:Cn:][:Co:][:Cs:]]", 20); |
3090 | 3127 |
3091 /* | 3128 /* |
3092 * It used to be that UCD.html and its precursors said | 3129 * It used to be that UCD.html and its precursors said |
3093 * "Those dashes used to mark connections between pieces of words, | 3130 * "Those dashes used to mark connections between pieces of words, |
3094 * plus the Katakana middle dot." | 3131 * plus the Katakana middle dot." |
3095 * | 3132 * |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 | 3357 |
3321 UErrorCode errorCode=U_ZERO_ERROR; | 3358 UErrorCode errorCode=U_ZERO_ERROR; |
3322 | 3359 |
3323 length=0; | 3360 length=0; |
3324 U16_APPEND_UNSAFE(s, length, c); | 3361 U16_APPEND_UNSAFE(s, length, c); |
3325 | 3362 |
3326 if((which&CF_SIMPLE)!=0 && (c2=u_foldCase(c, 0))!=simple) { | 3363 if((which&CF_SIMPLE)!=0 && (c2=u_foldCase(c, 0))!=simple) { |
3327 log_err("u_foldCase(U+%04lx, default)=U+%04lx != U+%04lx\n", (long)c, (l
ong)c2, (long)simple); | 3364 log_err("u_foldCase(U+%04lx, default)=U+%04lx != U+%04lx\n", (long)c, (l
ong)c2, (long)simple); |
3328 } | 3365 } |
3329 if((which&CF_FULL)!=0) { | 3366 if((which&CF_FULL)!=0) { |
3330 length2=u_strFoldCase(t, LENGTHOF(t), s, length, 0, &errorCode); | 3367 length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, 0, &errorCode); |
3331 if(length2!=fullLength || 0!=u_memcmp(t, full, fullLength)) { | 3368 if(length2!=fullLength || 0!=u_memcmp(t, full, fullLength)) { |
3332 log_err("u_strFoldCase(U+%04lx, default) does not fold properly\n",
(long)c); | 3369 log_err("u_strFoldCase(U+%04lx, default) does not fold properly\n",
(long)c); |
3333 } | 3370 } |
3334 } | 3371 } |
3335 if((which&CF_TURKIC)!=0) { | 3372 if((which&CF_TURKIC)!=0) { |
3336 if((c2=u_foldCase(c, U_FOLD_CASE_EXCLUDE_SPECIAL_I))!=turkic) { | 3373 if((c2=u_foldCase(c, U_FOLD_CASE_EXCLUDE_SPECIAL_I))!=turkic) { |
3337 log_err("u_foldCase(U+%04lx, turkic)=U+%04lx != U+%04lx\n", (long)c,
(long)c2, (long)simple); | 3374 log_err("u_foldCase(U+%04lx, turkic)=U+%04lx != U+%04lx\n", (long)c,
(long)c2, (long)simple); |
3338 } | 3375 } |
3339 | 3376 |
3340 length2=u_strFoldCase(t, LENGTHOF(t), s, length, U_FOLD_CASE_EXCLUDE_SPE
CIAL_I, &errorCode); | 3377 length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, U_FOLD_CASE_EXCLUD
E_SPECIAL_I, &errorCode); |
3341 if(length2!=turkicFullLength || 0!=u_memcmp(t, turkicFull, length2)) { | 3378 if(length2!=turkicFullLength || 0!=u_memcmp(t, turkicFull, length2)) { |
3342 log_err("u_strFoldCase(U+%04lx, turkic) does not fold properly\n", (
long)c); | 3379 log_err("u_strFoldCase(U+%04lx, turkic) does not fold properly\n", (
long)c); |
3343 } | 3380 } |
3344 } | 3381 } |
3345 } | 3382 } |
3346 | 3383 |
3347 /* test that c case-folds to itself */ | 3384 /* test that c case-folds to itself */ |
3348 static void | 3385 static void |
3349 testFoldToSelf(UChar32 c, int which) { | 3386 testFoldToSelf(UChar32 c, int which) { |
3350 UChar s[2]; | 3387 UChar s[2]; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3506 ++i | 3543 ++i |
3507 ) { | 3544 ) { |
3508 do { | 3545 do { |
3509 testFoldToSelf(start, CF_ALL); | 3546 testFoldToSelf(start, CF_ALL); |
3510 } while(++start<=end); | 3547 } while(++start<=end); |
3511 } | 3548 } |
3512 } | 3549 } |
3513 | 3550 |
3514 uset_close(data.notSeen); | 3551 uset_close(data.notSeen); |
3515 } | 3552 } |
OLD | NEW |