diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:10:19 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:10:19 +0000 |
commit | 6de2c08bc400b4aca9fb46684e8bdb56eed9b09f (patch) | |
tree | 32b4679ab4b8f28e5228daafc65e9dc436935353 /unittests/ADT/StringRefTest.cpp | |
parent | 4dc93743c9d40c29c0a3bec2aae328cac0d289e8 (diff) | |
download | FreeBSD-src-6de2c08bc400b4aca9fb46684e8bdb56eed9b09f.zip FreeBSD-src-6de2c08bc400b4aca9fb46684e8bdb56eed9b09f.tar.gz |
Vendor import of llvm release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/llvm/branches/release_32@168974
Diffstat (limited to 'unittests/ADT/StringRefTest.cpp')
-rw-r--r-- | unittests/ADT/StringRefTest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp index 315eacb..ead372f 100644 --- a/unittests/ADT/StringRefTest.cpp +++ b/unittests/ADT/StringRefTest.cpp @@ -456,4 +456,27 @@ 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 + , "0b2" // illegal bin characters + , "08" // illegal oct characters + , "0o8" // illegal oct characters + , "-123" // negative unsigned value +}; + + +TEST(StringRefTest, getAsUnsignedIntegerBadStrings) { + unsigned long long U64; + for (size_t i = 0; i < array_lengthof(BadStrings); ++i) { + bool IsBadNumber = StringRef(BadStrings[i]).getAsInteger(0, U64); + ASSERT_TRUE(IsBadNumber); + } +} + + + } // end anonymous namespace |