3
#import "allocators_test.h"
5
CPPUNIT_TEST_SUITE_REGISTRATION(AllocatorsTest);
8
bool is_aligned(const T& t) {
9
return t.empty() || (reinterpret_cast<int>(&t[0]) & (LT_SMP_CACHE_BYTES - 1)) == 0x0;
13
AllocatorsTest::testAlignment() {
14
aligned_vector_type v1;
15
aligned_vector_type v2(1, 'a');
16
aligned_vector_type v3(16, 'a');
17
aligned_vector_type v4(LT_SMP_CACHE_BYTES, 'b');
18
aligned_vector_type v5(1, 'a');
20
CPPUNIT_ASSERT(is_aligned(v1));
21
CPPUNIT_ASSERT(is_aligned(v2));
22
CPPUNIT_ASSERT(is_aligned(v3));
23
CPPUNIT_ASSERT(is_aligned(v4));
24
CPPUNIT_ASSERT(is_aligned(v5));