llvm.org GIT mirror llvm / 7a0f86f
Add getAsUnsignedInteger test case that checks that known bad values are rejected git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165136 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Kledzik 8 years ago
1 changed file(s) with 19 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
455455 }
456456 }
457457
458
459 static const char* BadStrings[] = {
460 "18446744073709551617" // value just over max
461 , "123456789012345678901" // value way too large
462 , "4t23v" // illegal decimal characters
463 , "0x123W56" // illegal hex characters
464 };
465
466
467 TEST(StringRefTest, getAsUnsignedIntegerBadStrings) {
468 uint64_t U64;
469 for (size_t i = 0; i < array_lengthof(BadStrings); ++i) {
470 bool IsBadNumber = getAsUnsignedInteger(BadStrings[i], 0, U64);
471 ASSERT_TRUE(IsBadNumber);
472 }
473 }
474
475
476
458477 } // end anonymous namespace