diff options
| author | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2009-08-16 23:36:01 +0000 |
|---|---|---|
| committer | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2009-08-16 23:36:01 +0000 |
| commit | 74e70064025b0af7510389e8c908bfc547daac55 (patch) | |
| tree | 3d2d334e395ccc0f1bbab510cd99cd2771c697e8 | |
| parent | 7dd09b28b4b3a16a8a71d0133a4a80a8abbd0e33 (diff) | |
| download | external_llvm-74e70064025b0af7510389e8c908bfc547daac55.zip external_llvm-74e70064025b0af7510389e8c908bfc547daac55.tar.gz external_llvm-74e70064025b0af7510389e8c908bfc547daac55.tar.bz2 | |
Add failure tests to APInt unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79209 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | unittests/ADT/APIntTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/ADT/APIntTest.cpp b/unittests/ADT/APIntTest.cpp index 4a6b176..207c633 100644 --- a/unittests/ADT/APIntTest.cpp +++ b/unittests/ADT/APIntTest.cpp @@ -172,4 +172,15 @@ TEST(APIntTest, fromString) { EXPECT_EQ(APInt(1, 1), APInt(1, "1", 16)); } +TEST(APIntTest, StringDeath) { + EXPECT_DEATH(APInt(0, "", 0), "bitwidth too small"); + EXPECT_DEATH(APInt(32, "", 0), "Radix should be 2, 8, 10, or 16!"); + EXPECT_DEATH(APInt(32, "", 10), "Invalid string length"); + EXPECT_DEATH(APInt(32, "-", 10), "string is only a minus!"); + EXPECT_DEATH(APInt(1, "1234", 10), "Insufficient bit width"); + EXPECT_DEATH(APInt(32, "\0", 10), "Invalid string length"); + EXPECT_DEATH(APInt(32, StringRef("1\02", 3), 10), "Invalid character in digit string"); + EXPECT_DEATH(APInt(32, "1L", 10), "Invalid character in digit string"); +} + } |
