[stdlib]Un-revert string comparison (#14694)

Restore (un-revert) sting comparison, with fixes

More exhaustive testing of opaque strings, which consistently reproduces prior sporadic failure. Shims fixups. Some test tweaking.
This commit is contained in:
Lance Parker
2018-02-18 10:50:33 -08:00
committed by Michael Ilseman
parent 76af5c5b16
commit 0661de22a2
18 changed files with 2001 additions and 431 deletions

View File

@@ -92,7 +92,7 @@ let tests = [
ComparisonTest(.eq, "\u{212b}", "A\u{30a}"),
ComparisonTest(.eq, "\u{212b}", "\u{c5}"),
ComparisonTest(.eq, "A\u{30a}", "\u{c5}"),
ComparisonTest(.lt, "A\u{30a}", "a"),
ComparisonTest(.gt, "A\u{30a}", "a"),
ComparisonTest(.lt, "A", "A\u{30a}"),
// U+2126 OHM SIGN
@@ -176,25 +176,7 @@ func checkStringComparison(
// Mark the test cases that are expected to fail in checkStringComparison
let comparisonTests = tests.map {
(test: ComparisonTest) -> ComparisonTest in
switch (test.expectedUnicodeCollation, test.lhs, test.rhs) {
case (.gt, "t", "Tt"), (.lt, "A\u{30a}", "a"):
return test.replacingPredicate(.nativeRuntime(
"Comparison reversed between ICU and CFString, https://bugs.swift.org/browse/SR-530"))
case (.gt, "\u{0}", ""), (.lt, "\u{0}", "\u{0}\u{0}"):
return test.replacingPredicate(.nativeRuntime(
"Null-related issue: https://bugs.swift.org/browse/SR-630"))
case (.lt, "\u{0301}", "\u{0954}"), (.lt, "\u{0341}", "\u{0954}"):
return test.replacingPredicate(.nativeRuntime(
"Compares as equal with ICU"))
default:
return test
}
}
let comparisonTests = tests
for test in comparisonTests {
StringTests.test("String.{Equatable,Hashable,Comparable}: line \(test.loc.line)")