[PATCH] D22443: Add tests for max/minIntN(64).

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 16 15:19:54 PDT 2016


jlebar created this revision.
jlebar added a reviewer: rnk.
jlebar added subscribers: llvm-commits, dylanmckay.

Given that we had a bug on max/minUIntN(64), these should have tests
too.

https://reviews.llvm.org/D22443

Files:
  unittests/Support/MathExtrasTest.cpp

Index: unittests/Support/MathExtrasTest.cpp
===================================================================
--- unittests/Support/MathExtrasTest.cpp
+++ unittests/Support/MathExtrasTest.cpp
@@ -121,11 +121,15 @@
 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22443.64235.patch
Type: text/x-patch
Size: 713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160716/6f3dc4c8/attachment.bin>


More information about the llvm-commits mailing list