Files
swift-mirror/test/1_stdlib/StringOrderRelation.swift
Rene Treffer c404cf21bf Failing string ordering on linux test
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"
2016-01-27 21:32:31 +01:00

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()