summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-10-03 18:54:36 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-10-03 18:54:36 +0000
commite25de4ae04db1d773b1caaa83dc7e301b22d5143 (patch)
tree2b52f6f576d6442f7c9cd6ccbfc9fccf87b5f08d /unittests
parent7a0f86fa7822ae02d9d4f8f992d854a4bcc2a8bd (diff)
downloadllvm-e25de4ae04db1d773b1caaa83dc7e301b22d5143.tar.gz
llvm-e25de4ae04db1d773b1caaa83dc7e301b22d5143.tar.bz2
llvm-e25de4ae04db1d773b1caaa83dc7e301b22d5143.tar.xz
Don't call getAsUnsignedInteger directly, it fails to compile if uint64_t is not "unsigned long long".
while there add more test cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/StringRefTest.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp
index 59eed54f03..e9c017babf 100644
--- a/unittests/ADT/StringRefTest.cpp
+++ b/unittests/ADT/StringRefTest.cpp
@@ -462,13 +462,17 @@ static const char* BadStrings[] = {
, "123456789012345678901" // value way too large
, "4t23v" // illegal decimal characters
, "0x123W56" // illegal hex characters
+ , "0b2" // illegal bin characters
+ , "08" // illegal oct characters
+ , "0o8" // illegal oct characters
+ , "-123" // negative unsigned value
};
TEST(StringRefTest, getAsUnsignedIntegerBadStrings) {
uint64_t U64;
for (size_t i = 0; i < array_lengthof(BadStrings); ++i) {
- bool IsBadNumber = getAsUnsignedInteger(BadStrings[i], 0, U64);
+ bool IsBadNumber = StringRef(BadStrings[i]).getAsInteger(0, U64);
ASSERT_TRUE(IsBadNumber);
}
}