llvm.org GIT mirror llvm / e25de4a
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 Benjamin Kramer 8 years ago
1 changed file(s) with 5 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
461461 , "123456789012345678901" // value way too large
462462 , "4t23v" // illegal decimal characters
463463 , "0x123W56" // illegal hex characters
464 , "0b2" // illegal bin characters
465 , "08" // illegal oct characters
466 , "0o8" // illegal oct characters
467 , "-123" // negative unsigned value
464468 };
465469
466470
467471 TEST(StringRefTest, getAsUnsignedIntegerBadStrings) {
468472 uint64_t U64;
469473 for (size_t i = 0; i < array_lengthof(BadStrings); ++i) {
470 bool IsBadNumber = getAsUnsignedInteger(BadStrings[i], 0, U64);
474 bool IsBadNumber = StringRef(BadStrings[i]).getAsInteger(0, U64);
471475 ASSERT_TRUE(IsBadNumber);
472476 }
473477 }