LEFT | RIGHT |
(no file at all) | |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 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 (c) 1997-2016, International Business Machines Corporation and | 4 * Copyright (c) 1997-2016, International Business Machines Corporation and |
5 * others. All Rights Reserved. | 5 * others. All Rights Reserved. |
6 ********************************************************************/ | 6 ********************************************************************/ |
7 | 7 |
8 #include "unicode/ustring.h" | 8 #include "unicode/ustring.h" |
9 #include "unicode/uchar.h" | 9 #include "unicode/uchar.h" |
10 #include "unicode/uniset.h" | 10 #include "unicode/uniset.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 TESTCASE_AUTO_BEGIN; | 57 TESTCASE_AUTO_BEGIN; |
58 TESTCASE_AUTO(TestAdditionalProperties); | 58 TESTCASE_AUTO(TestAdditionalProperties); |
59 TESTCASE_AUTO(TestBinaryValues); | 59 TESTCASE_AUTO(TestBinaryValues); |
60 TESTCASE_AUTO(TestConsistency); | 60 TESTCASE_AUTO(TestConsistency); |
61 TESTCASE_AUTO(TestPatternProperties); | 61 TESTCASE_AUTO(TestPatternProperties); |
62 TESTCASE_AUTO(TestScriptMetadata); | 62 TESTCASE_AUTO(TestScriptMetadata); |
63 TESTCASE_AUTO(TestBidiPairedBracketType); | 63 TESTCASE_AUTO(TestBidiPairedBracketType); |
64 TESTCASE_AUTO(TestEmojiProperties); | 64 TESTCASE_AUTO(TestEmojiProperties); |
65 TESTCASE_AUTO(TestDefaultScriptExtensions); | 65 TESTCASE_AUTO(TestDefaultScriptExtensions); |
| 66 TESTCASE_AUTO(TestInvalidCodePointFolding); |
66 TESTCASE_AUTO_END; | 67 TESTCASE_AUTO_END; |
67 } | 68 } |
68 | 69 |
69 //==================================================== | 70 //==================================================== |
70 // private data used by the tests | 71 // private data used by the tests |
71 //==================================================== | 72 //==================================================== |
72 | 73 |
73 // test DerivedCoreProperties.txt ------------------------------------------- | 74 // test DerivedCoreProperties.txt ------------------------------------------- |
74 | 75 |
75 // copied from genprops.c | 76 // copied from genprops.c |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 UScriptCode scx[20]; | 540 UScriptCode scx[20]; |
540 scx[0] = USCRIPT_INVALID_CODE; | 541 scx[0] = USCRIPT_INVALID_CODE; |
541 assertEquals("U+3000 num scx", 1, // IDEOGRAPHIC SPACE | 542 assertEquals("U+3000 num scx", 1, // IDEOGRAPHIC SPACE |
542 uscript_getScriptExtensions(0x3000, scx, UPRV_LENGTHOF(scx), er
rorCode)); | 543 uscript_getScriptExtensions(0x3000, scx, UPRV_LENGTHOF(scx), er
rorCode)); |
543 assertEquals("U+3000 num scx[0]", USCRIPT_COMMON, scx[0]); | 544 assertEquals("U+3000 num scx[0]", USCRIPT_COMMON, scx[0]); |
544 scx[0] = USCRIPT_INVALID_CODE; | 545 scx[0] = USCRIPT_INVALID_CODE; |
545 assertEquals("U+3012 num scx", 1, // POSTAL MARK | 546 assertEquals("U+3012 num scx", 1, // POSTAL MARK |
546 uscript_getScriptExtensions(0x3012, scx, UPRV_LENGTHOF(scx), er
rorCode)); | 547 uscript_getScriptExtensions(0x3012, scx, UPRV_LENGTHOF(scx), er
rorCode)); |
547 assertEquals("U+3012 num scx[0]", USCRIPT_COMMON, scx[0]); | 548 assertEquals("U+3012 num scx[0]", USCRIPT_COMMON, scx[0]); |
548 } | 549 } |
| 550 |
| 551 void UnicodeTest::TestInvalidCodePointFolding(void) { |
| 552 // Test behavior when an invalid code point is passed to u_foldCase |
| 553 static const UChar32 invalidCodePoints[] = { |
| 554 0xD800, // lead surrogate |
| 555 0xDFFF, // trail surrogate |
| 556 0xFDD0, // noncharacter |
| 557 0xFFFF, // noncharacter |
| 558 0x110000, // out of range |
| 559 -1 // negative |
| 560 }; |
| 561 for (auto cp : invalidCodePoints) { |
| 562 assertEquals("Invalid code points should be echoed back", |
| 563 cp, u_foldCase(cp, U_FOLD_CASE_DEFAULT)); |
| 564 assertEquals("Invalid code points should be echoed back", |
| 565 cp, u_foldCase(cp, U_FOLD_CASE_EXCLUDE_SPECIAL_I)); |
| 566 } |
| 567 } |
LEFT | RIGHT |