diff options
Diffstat (limited to 'llvm/unittests/ADT/APIntTest.cpp')
| -rw-r--r-- | llvm/unittests/ADT/APIntTest.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp index 2a3abbfaf16..b6fee5b7ff1 100644 --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -2845,4 +2845,21 @@ TEST(APIntTest, GetMostSignificantDifferentBitExaustive) { } } +TEST(APIntTest, SignbitZeroChecks) { + EXPECT_TRUE(APInt(8, -1).isNegative()); + EXPECT_FALSE(APInt(8, -1).isNonNegative()); + EXPECT_FALSE(APInt(8, -1).isStrictlyPositive()); + EXPECT_TRUE(APInt(8, -1).isNonPositive()); + + EXPECT_FALSE(APInt(8, 0).isNegative()); + EXPECT_TRUE(APInt(8, 0).isNonNegative()); + EXPECT_FALSE(APInt(8, 0).isStrictlyPositive()); + EXPECT_TRUE(APInt(8, 0).isNonPositive()); + + EXPECT_FALSE(APInt(8, 1).isNegative()); + EXPECT_TRUE(APInt(8, 1).isNonNegative()); + EXPECT_TRUE(APInt(8, 1).isStrictlyPositive()); + EXPECT_FALSE(APInt(8, 1).isNonPositive()); +} + } // end anonymous namespace |

