mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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
This commit is contained in:
parent
739dc6e6d8
commit
7a0f86fa78
@ -456,4 +456,23 @@ TEST(StringRefTest, getAsInteger) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const char* BadStrings[] = {
|
||||
"18446744073709551617" // value just over max
|
||||
, "123456789012345678901" // value way too large
|
||||
, "4t23v" // illegal decimal characters
|
||||
, "0x123W56" // illegal hex characters
|
||||
};
|
||||
|
||||
|
||||
TEST(StringRefTest, getAsUnsignedIntegerBadStrings) {
|
||||
uint64_t U64;
|
||||
for (size_t i = 0; i < array_lengthof(BadStrings); ++i) {
|
||||
bool IsBadNumber = getAsUnsignedInteger(BadStrings[i], 0, U64);
|
||||
ASSERT_TRUE(IsBadNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Loading…
Reference in New Issue
Block a user