diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-26 14:21:08 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-26 14:21:08 +0000 |
commit | 0043e35b8261af607d6cf0695b79b1d6584e67ac (patch) | |
tree | 2e88df1ae7791f609935964c877098903298034d /unittests | |
parent | 01b1e1c958d50b79acdf90824f36f7cb8a5be884 (diff) | |
download | external_llvm-0043e35b8261af607d6cf0695b79b1d6584e67ac.zip external_llvm-0043e35b8261af607d6cf0695b79b1d6584e67ac.tar.gz external_llvm-0043e35b8261af607d6cf0695b79b1d6584e67ac.tar.bz2 |
Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ADT/StringRefTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp index 887ba5d..de5c349 100644 --- a/unittests/ADT/StringRefTest.cpp +++ b/unittests/ADT/StringRefTest.cpp @@ -53,6 +53,14 @@ TEST(StringRefTest, StringOps) { EXPECT_EQ( 1, StringRef("aab").compare("aaa")); EXPECT_EQ(-1, StringRef("aab").compare("aabb")); EXPECT_EQ( 1, StringRef("aab").compare("aa")); + EXPECT_EQ( 1, StringRef("\xFF").compare("\1")); + + EXPECT_EQ(-1, StringRef("AaB").compare_lower("aAd")); + EXPECT_EQ( 0, StringRef("AaB").compare_lower("aab")); + EXPECT_EQ( 1, StringRef("AaB").compare_lower("AAA")); + EXPECT_EQ(-1, StringRef("AaB").compare_lower("aaBb")); + EXPECT_EQ( 1, StringRef("AaB").compare_lower("aA")); + EXPECT_EQ( 1, StringRef("\xFF").compare_lower("\1")); EXPECT_EQ(-1, StringRef("aab").compare_numeric("aad")); EXPECT_EQ( 0, StringRef("aab").compare_numeric("aab")); |