Test case was forming the wrong limits when size_t != unsigned long.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2013-03-29 21:22:22 +00:00
parent fc2f021bdd
commit 9d00ed5d87

View File

@ -11,6 +11,7 @@
#include <bitset> #include <bitset>
#include <algorithm> #include <algorithm>
#include <limits>
#include <climits> #include <climits>
#include <cassert> #include <cassert>
@ -19,7 +20,7 @@ void test_to_ulong()
{ {
const std::size_t M = sizeof(unsigned long) * CHAR_BIT < N ? sizeof(unsigned long) * CHAR_BIT : N; const std::size_t M = sizeof(unsigned long) * CHAR_BIT < N ? sizeof(unsigned long) * CHAR_BIT : N;
const std::size_t X = M == 0 ? sizeof(unsigned long) * CHAR_BIT - 1 : sizeof(unsigned long) * CHAR_BIT - M; const std::size_t X = M == 0 ? sizeof(unsigned long) * CHAR_BIT - 1 : sizeof(unsigned long) * CHAR_BIT - M;
const std::size_t max = M == 0 ? 0 : std::size_t(-1) >> X; const std::size_t max = M == 0 ? 0 : std::size_t(std::numeric_limits<unsigned long>::max()) >> X;
std::size_t tests[] = {0, std::size_t tests[] = {0,
std::min<std::size_t>(1, max), std::min<std::size_t>(1, max),
std::min<std::size_t>(2, max), std::min<std::size_t>(2, max),