OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2013, International Business Machines Corporation and | 3 * Copyright (c) 1997-2013, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 /* file name: cbiditst.c | 6 /* file name: cbiditst.c |
7 * encoding: US-ASCII | 7 * encoding: US-ASCII |
8 * tab size: 8 (not used) | 8 * tab size: 8 (not used) |
9 * indentation:4 | 9 * indentation:4 |
10 * | 10 * |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 static void testFailureRecovery(void); | 77 static void testFailureRecovery(void); |
78 | 78 |
79 static void testMultipleParagraphs(void); | 79 static void testMultipleParagraphs(void); |
80 | 80 |
81 static void testGetBaseDirection(void); | 81 static void testGetBaseDirection(void); |
82 | 82 |
83 static void testContext(void); | 83 static void testContext(void); |
84 | 84 |
85 static void doTailTest(void); | 85 static void doTailTest(void); |
86 | 86 |
| 87 static void testBracketOverflow(void); |
| 88 |
87 /* new BIDI API */ | 89 /* new BIDI API */ |
88 static void testReorderingMode(void); | 90 static void testReorderingMode(void); |
89 static void testReorderRunsOnly(void); | 91 static void testReorderRunsOnly(void); |
90 static void testStreaming(void); | 92 static void testStreaming(void); |
91 static void testClassOverride(void); | 93 static void testClassOverride(void); |
92 static const char* inverseBasic(UBiDi *pBiDi, const char *src, int32_t srcLen, | 94 static const char* inverseBasic(UBiDi *pBiDi, const char *src, int32_t srcLen, |
93 uint32_t option, UBiDiLevel level, char *result)
; | 95 uint32_t option, UBiDiLevel level, char *result)
; |
94 static UBool assertRoundTrip(UBiDi *pBiDi, int32_t tc, int32_t outIndex, | 96 static UBool assertRoundTrip(UBiDi *pBiDi, int32_t tc, int32_t outIndex, |
95 const char *srcChars, const char *destChars, | 97 const char *srcChars, const char *destChars, |
96 const UChar *dest, int32_t destLen, int mode, | 98 const UChar *dest, int32_t destLen, int mode, |
(...skipping 26 matching lines...) Expand all Loading... |
123 addTest(root, testInverse, "complex/bidi/TestInverse"); | 125 addTest(root, testInverse, "complex/bidi/TestInverse"); |
124 addTest(root, testReorder,"complex/bidi/TestReorder"); | 126 addTest(root, testReorder,"complex/bidi/TestReorder"); |
125 addTest(root, testFailureRecovery,"complex/bidi/TestFailureRecovery"); | 127 addTest(root, testFailureRecovery,"complex/bidi/TestFailureRecovery"); |
126 addTest(root, testMultipleParagraphs,"complex/bidi/TestMultipleParagraphs"); | 128 addTest(root, testMultipleParagraphs,"complex/bidi/TestMultipleParagraphs"); |
127 addTest(root, testReorderingMode, "complex/bidi/TestReorderingMode"); | 129 addTest(root, testReorderingMode, "complex/bidi/TestReorderingMode"); |
128 addTest(root, testReorderRunsOnly, "complex/bidi/TestReorderRunsOnly"); | 130 addTest(root, testReorderRunsOnly, "complex/bidi/TestReorderRunsOnly"); |
129 addTest(root, testStreaming, "complex/bidi/TestStreaming"); | 131 addTest(root, testStreaming, "complex/bidi/TestStreaming"); |
130 addTest(root, testClassOverride, "complex/bidi/TestClassOverride"); | 132 addTest(root, testClassOverride, "complex/bidi/TestClassOverride"); |
131 addTest(root, testGetBaseDirection, "complex/bidi/testGetBaseDirection"); | 133 addTest(root, testGetBaseDirection, "complex/bidi/testGetBaseDirection"); |
132 addTest(root, testContext, "complex/bidi/testContext"); | 134 addTest(root, testContext, "complex/bidi/testContext"); |
| 135 addTest(root, testBracketOverflow, "complex/bidi/TestBracketOverflow"); |
133 | 136 |
134 addTest(root, doArabicShapingTest, "complex/arabic-shaping/ArabicShapingTest
"); | 137 addTest(root, doArabicShapingTest, "complex/arabic-shaping/ArabicShapingTest
"); |
135 addTest(root, doLamAlefSpecialVLTRArabicShapingTest, "complex/arabic-shaping
/lamalef"); | 138 addTest(root, doLamAlefSpecialVLTRArabicShapingTest, "complex/arabic-shaping
/lamalef"); |
136 addTest(root, doTashkeelSpecialVLTRArabicShapingTest, "complex/arabic-shapin
g/tashkeel"); | 139 addTest(root, doTashkeelSpecialVLTRArabicShapingTest, "complex/arabic-shapin
g/tashkeel"); |
137 addTest(root, doLOGICALArabicDeShapingTest, "complex/arabic-shaping/unshapin
g"); | 140 addTest(root, doLOGICALArabicDeShapingTest, "complex/arabic-shaping/unshapin
g"); |
138 addTest(root, doArabicShapingTestForBug5421, "complex/arabic-shaping/bug-542
1"); | 141 addTest(root, doArabicShapingTestForBug5421, "complex/arabic-shaping/bug-542
1"); |
139 addTest(root, doTailTest, "complex/arabic-shaping/tailtest"); | 142 addTest(root, doTailTest, "complex/arabic-shaping/tailtest"); |
140 addTest(root, doArabicShapingTestForBug8703, "complex/arabic-shaping/bug-870
3"); | 143 addTest(root, doArabicShapingTestForBug8703, "complex/arabic-shaping/bug-870
3"); |
141 addTest(root, testReorderArabicMathSymbols, "complex/bidi/bug-9024"); | 144 addTest(root, testReorderArabicMathSymbols, "complex/bidi/bug-9024"); |
142 addTest(root, doArabicShapingTestForBug9024, "complex/arabic-shaping/bug-902
4"); | 145 addTest(root, doArabicShapingTestForBug9024, "complex/arabic-shaping/bug-902
4"); |
(...skipping 4504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4647 testOK = FALSE; | 4650 testOK = FALSE; |
4648 } | 4651 } |
4649 } | 4652 } |
4650 if (testOK == TRUE) { | 4653 if (testOK == TRUE) { |
4651 log_verbose("\nContext test OK\n"); | 4654 log_verbose("\nContext test OK\n"); |
4652 } | 4655 } |
4653 ubidi_close(pBiDi); | 4656 ubidi_close(pBiDi); |
4654 | 4657 |
4655 log_verbose("\nExiting TestContext \n\n"); | 4658 log_verbose("\nExiting TestContext \n\n"); |
4656 } | 4659 } |
| 4660 |
| 4661 /* Ticket#11054 ubidi_setPara crash with heavily nested brackets */ |
| 4662 static void |
| 4663 testBracketOverflow(void) { |
| 4664 static const char* TEXT = "(((((((((((((((((((((((((((((((((((((((((a)(A))))
)))))))))))))))))))))))))))))))))))))"; |
| 4665 UErrorCode status = U_ZERO_ERROR; |
| 4666 UBiDi* bidi; |
| 4667 UChar src[100]; |
| 4668 UChar dest[100]; |
| 4669 int32_t len; |
| 4670 |
| 4671 bidi = ubidi_open(); |
| 4672 len = uprv_strlen(TEXT); |
| 4673 pseudoToU16(len, TEXT, src); |
| 4674 ubidi_setPara(bidi, src, len, UBIDI_DEFAULT_LTR , NULL, &status); |
| 4675 if (U_FAILURE(status)) { |
| 4676 log_err("setPara failed with heavily nested brackets - %s", u_errorName(
status)); |
| 4677 } |
| 4678 |
| 4679 ubidi_close(bidi); |
| 4680 } |
| 4681 |
OLD | NEW |