OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************** | 2 ********************************************************************** |
3 * Copyright (C) 2005-2013, International Business Machines | 3 * Copyright (C) 2005-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************** | 5 ********************************************************************** |
6 */ | 6 */ |
7 | 7 |
8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
9 | 9 |
10 #if !UCONFIG_NO_COLLATION | 10 #if !UCONFIG_NO_COLLATION |
11 | 11 |
12 #include "cmemory.h" | 12 #include "cmemory.h" |
13 #include "cstring.h" | 13 #include "cstring.h" |
14 #include "ucol_imp.h" | 14 #include "usrchimp.h" |
15 | 15 |
16 #include "unicode/coll.h" | 16 #include "unicode/coll.h" |
17 #include "unicode/tblcoll.h" | 17 #include "unicode/tblcoll.h" |
18 #include "unicode/usearch.h" | 18 #include "unicode/usearch.h" |
19 #include "unicode/uset.h" | 19 #include "unicode/uset.h" |
20 #include "unicode/ustring.h" | 20 #include "unicode/ustring.h" |
21 | 21 |
22 #include "unicode/coleitr.h" | 22 #include "unicode/coleitr.h" |
23 #include "unicode/regex.h" // TODO: make conditional on regexp being buil
t. | 23 #include "unicode/regex.h" // TODO: make conditional on regexp being buil
t. |
24 | 24 |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 errcheckln(status, "Failed to create collator in offsetTest! - %s", u_er
rorName(status)); | 622 errcheckln(status, "Failed to create collator in offsetTest! - %s", u_er
rorName(status)); |
623 return; | 623 return; |
624 } | 624 } |
625 char buffer[4096]; // A bit of a hack... just happens to be long enough for
all the test cases... | 625 char buffer[4096]; // A bit of a hack... just happens to be long enough for
all the test cases... |
626 // We could allocate one that's the right size by (CE_co
unt * 10) + 2 | 626 // We could allocate one that's the right size by (CE_co
unt * 10) + 2 |
627 // 10 chars is enough room for 8 hex digits plus ", ". 2
extra chars for "[" and "]" | 627 // 10 chars is enough room for 8 hex digits plus ", ". 2
extra chars for "[" and "]" |
628 | 628 |
629 col->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); | 629 col->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); |
630 | 630 |
631 for(int32_t i = 0; i < testCount; i += 1) { | 631 for(int32_t i = 0; i < testCount; i += 1) { |
632 if (i>=4 && i<=6 && logKnownIssue("9156", "was 8081")) { | |
633 continue; // timebomb until ticket #9156 (was #8081) is resolved | |
634 } | |
635 UnicodeString ts = CharsToUnicodeString(test[i]); | 632 UnicodeString ts = CharsToUnicodeString(test[i]); |
636 CollationElementIterator *iter = col->createCollationElementIterator(ts)
; | 633 CollationElementIterator *iter = col->createCollationElementIterator(ts)
; |
637 OrderList forwardList; | 634 OrderList forwardList; |
638 OrderList backwardList; | 635 OrderList backwardList; |
639 int32_t order, low, high; | 636 int32_t order, low, high; |
640 | 637 |
641 do { | 638 do { |
642 low = iter->getOffset(); | 639 low = iter->getOffset(); |
643 order = iter->next(status); | 640 order = iter->next(status); |
644 high = iter->getOffset(); | 641 high = iter->getOffset(); |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 #endif | 1439 #endif |
1443 } | 1440 } |
1444 | 1441 |
1445 for(int32_t s = firstStrength; s <= lastStrength; s += 1) { | 1442 for(int32_t s = firstStrength; s <= lastStrength; s += 1) { |
1446 int32_t notFoundCount = 0; | 1443 int32_t notFoundCount = 0; |
1447 | 1444 |
1448 logln("Setting strength to %s.", strengthNames[s]); | 1445 logln("Setting strength to %s.", strengthNames[s]); |
1449 ucol_setStrength(coll, strengths[s]); | 1446 ucol_setStrength(coll, strengths[s]); |
1450 | 1447 |
1451 // TODO: try alternate prefix and suffix too? | 1448 // TODO: try alternate prefix and suffix too? |
1452 // TODO: alterntaes are only equal at primary strength. Is this OK? | 1449 // TODO: alternates are only equal at primary strength. Is this OK? |
1453 for(int32_t t = 0; t < loopCount; t += 1) { | 1450 for(int32_t t = 0; t < loopCount; t += 1) { |
1454 uint32_t seed = m_seed; | 1451 uint32_t seed = m_seed; |
1455 // int32_t nmc = 0; | 1452 // int32_t nmc = 0; |
1456 | 1453 |
1457 generateTestCase(coll, monkeys, monkeyCount, pattern, altPattern); | 1454 generateTestCase(coll, monkeys, monkeyCount, pattern, altPattern); |
1458 generateTestCase(coll, monkeys, monkeyCount, prefix, altPrefix); | 1455 generateTestCase(coll, monkeys, monkeyCount, prefix, altPrefix); |
1459 generateTestCase(coll, monkeys, monkeyCount, suffix, altSuffix); | 1456 generateTestCase(coll, monkeys, monkeyCount, suffix, altSuffix); |
1460 | 1457 |
1461 // pattern | 1458 // pattern |
1462 notFoundCount += monkeyTestCase(coll, pattern, pattern, altPattern,
"pattern", strengthNames[s], seed); | 1459 notFoundCount += monkeyTestCase(coll, pattern, pattern, altPattern,
"pattern", strengthNames[s], seed); |
(...skipping 25 matching lines...) Expand all Loading... |
1488 uset_close(expansions); | 1485 uset_close(expansions); |
1489 uset_close(letters); | 1486 uset_close(letters); |
1490 delete monkeyData; | 1487 delete monkeyData; |
1491 | 1488 |
1492 ucol_close(coll); | 1489 ucol_close(coll); |
1493 } | 1490 } |
1494 | 1491 |
1495 #endif | 1492 #endif |
1496 | 1493 |
1497 #endif | 1494 #endif |
OLD | NEW |