aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/MathExtrasTest.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-07-17 18:19:28 +0000
committerJustin Lebar <jlebar@google.com>2016-07-17 18:19:28 +0000
commit1e50e3b3e39727a0279cfde8d4190c63975eed11 (patch)
tree6bde3a11f02a963e3df49c68d0c0ddd7d5cdd37f /llvm/unittests/Support/MathExtrasTest.cpp
parentb59c1dd5cf31b90ac94164259791d74acd1d9ff3 (diff)
downloadllvm-1e50e3b3e39727a0279cfde8d4190c63975eed11.zip
llvm-1e50e3b3e39727a0279cfde8d4190c63975eed11.tar.gz
llvm-1e50e3b3e39727a0279cfde8d4190c63975eed11.tar.bz2
Add tests for max/minIntN(64).
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 llvm-svn: 275723
Diffstat (limited to 'llvm/unittests/Support/MathExtrasTest.cpp')
-rw-r--r--llvm/unittests/Support/MathExtrasTest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/unittests/Support/MathExtrasTest.cpp b/llvm/unittests/Support/MathExtrasTest.cpp
index 3d449cc..d373030 100644
--- a/llvm/unittests/Support/MathExtrasTest.cpp
+++ b/llvm/unittests/Support/MathExtrasTest.cpp
@@ -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) {