Files
swift-mirror/validation-test/stdlib/HashingICU.swift
Arnold Schwaighofer 3ec9325c58 stdlib: Don't hash in the length of the string
Some characters are not considered when comparing strings. Hashing in the length
would cause a difference of hash values in equal strings.

Swift SVN r31468
2015-08-26 02:00:20 +00:00

21 lines
627 B
Swift

// RUN: %target-run-simple-swift | FileCheck %s
// REQUIRES: executable_test
// REQUIRES: OS=linux-gnu
// Validation of hashes produced by ICU-based methods used on linux. Doesn't
// use StdlibUnittest because that doesn't work on linux yet. May go away in
// favour of the more comprehensive tests that already exist once it does.
// Let's not crash on changing case.
let upper = "\u{00df}".uppercaseString
let lower = "\u{0130}".lowercaseString
// ASCII strings
// CHECK: true
print("abc".hashValue == "\0abc".hashValue)
// Unicode strings
// CHECK-NEXT: true
print("abc\u{0130}".hashValue == "\0abc\u{0130}".hashValue)