mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This testcase illustrates a problem on linux where - at the time of writing - the strings "a" and "a\0" satisfied "a" <= "a\0" "a" >= "a\0" "a" != "a\0"
29 lines
814 B
Swift
29 lines
814 B
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
|
|
import StdlibUnittest
|
|
|
|
// Also import modules which are used by StdlibUnittest internally. This
|
|
// workaround is needed to link all required libraries in case we compile
|
|
// StdlibUnittest with -sil-serialize-all.
|
|
import SwiftPrivate
|
|
#if _runtime(_ObjC)
|
|
import ObjectiveC
|
|
#endif
|
|
|
|
var StringOrderRelationTestSuite = TestSuite("StringOrderRelation")
|
|
|
|
StringOrderRelationTestSuite.test("StringOrderRelation/ASCII/NullByte") {
|
|
let baseString = "a"
|
|
let nullbyteString = "a\0"
|
|
expectTrue(baseString < nullbyteString)
|
|
expectTrue(baseString <= nullbyteString)
|
|
expectFalse(baseString > nullbyteString)
|
|
expectFalse(baseString >= nullbyteString)
|
|
expectFalse(baseString == nullbyteString)
|
|
expectTrue(baseString != nullbyteString)
|
|
}
|
|
|
|
runAllTests()
|
|
|