test/utilities: Fix LLP64-aware.

This commit is contained in:
NAKAMURA Takumi
2011-04-25 16:57:21 +09:00
parent cb430f3a47
commit ec97728ba0
3 changed files with 11 additions and 11 deletions

View File

@@ -92,17 +92,17 @@ int main()
} }
{ {
typedef std::aligned_storage<8>::type T1; typedef std::aligned_storage<8>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); static_assert(std::alignment_of<T1>::value == (sizeof(void*) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == 8, ""); static_assert(sizeof(T1) == 8, "");
} }
{ {
typedef std::aligned_storage<9>::type T1; typedef std::aligned_storage<9>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); static_assert(std::alignment_of<T1>::value == (sizeof(void*) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), ""); static_assert(sizeof(T1) == (sizeof(void*) == 4 ? 12 : 16), "");
} }
{ {
typedef std::aligned_storage<15>::type T1; typedef std::aligned_storage<15>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); static_assert(std::alignment_of<T1>::value == (sizeof(void*) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == 16, ""); static_assert(sizeof(T1) == 16, "");
} }
{ {
@@ -117,7 +117,7 @@ int main()
} }
{ {
typedef std::aligned_storage<10>::type T1; typedef std::aligned_storage<10>::type T1;
static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), ""); static_assert(std::alignment_of<T1>::value == (sizeof(void*) == 4 ? 4 : 8), "");
static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), ""); static_assert(sizeof(T1) == (sizeof(void*) == 4 ? 12 : 16), "");
} }
} }

View File

@@ -30,13 +30,13 @@ public:
int main() int main()
{ {
test_alignment_of<int&, sizeof(long) == 4 ? 4 : 8>(); test_alignment_of<int&, sizeof(void*) == 4 ? 4 : 8>();
test_alignment_of<Class, 1>(); test_alignment_of<Class, 1>();
test_alignment_of<int*, sizeof(long) == 4 ? 4 : 8>(); test_alignment_of<int*, sizeof(void*) == 4 ? 4 : 8>();
test_alignment_of<const int*, sizeof(long) == 4 ? 4 : 8>(); test_alignment_of<const int*, sizeof(void*) == 4 ? 4 : 8>();
test_alignment_of<char[3], 1>(); test_alignment_of<char[3], 1>();
test_alignment_of<int, 4>(); test_alignment_of<int, 4>();
test_alignment_of<double, sizeof(long) == 4 ? 4 : 8>(); test_alignment_of<double, sizeof(void*) == 4 ? 4 : 8>();
test_alignment_of<bool, 1>(); test_alignment_of<bool, 1>();
test_alignment_of<unsigned, 4>(); test_alignment_of<unsigned, 4>();
} }

View File

@@ -30,7 +30,7 @@ void test_to_ulong()
max}; max};
for (std::size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) for (std::size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
{ {
std::size_t j = tests[i]; unsigned long j = tests[i];
std::bitset<N> v(j); std::bitset<N> v(j);
assert(j == v.to_ulong()); assert(j == v.to_ulong());
} }