Add tests for max/minIntN(64).
authorJustin Lebar <jlebar@google.com>
Sun, 17 Jul 2016 18:19:28 +0000 (18:19 +0000)
committerJustin Lebar <jlebar@google.com>
Sun, 17 Jul 2016 18:19:28 +0000 (18:19 +0000)
Summary:
Given that we had a bug on max/minUIntN(64), these should have tests
too.

Reviewers: rnk

Subscribers: dylanmckay, llvm-commits

Differential Revision: https://reviews.llvm.org/D22443

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275723 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/MathExtrasTest.cpp

index 3d449ccb209027f67292bceb5ae0a6919af85252..d373030881ec75e6ddebb10d5438d1b2f1531c43 100644 (file)
@@ -121,11 +121,15 @@ TEST(MathExtras, isUIntN) {
 TEST(MathExtras, maxIntN) {
   EXPECT_EQ(32767, maxIntN(16));
   EXPECT_EQ(2147483647, maxIntN(32));
+  EXPECT_EQ(std::numeric_limits<int32_t>::max(), maxIntN(32));
+  EXPECT_EQ(std::numeric_limits<int64_t>::max(), maxIntN(64));
 }
 
 TEST(MathExtras, minIntN) {
   EXPECT_EQ(-32768LL, minIntN(16));
   EXPECT_EQ(-64LL, minIntN(7));
+  EXPECT_EQ(std::numeric_limits<int32_t>::min(), minIntN(32));
+  EXPECT_EQ(std::numeric_limits<int64_t>::min(), minIntN(64));
 }
 
 TEST(MathExtras, maxUIntN) {