MCPcopy Create free account
hub / github.com/darktable-org/rawspeed / AlignedMallocTest

Class AlignedMallocTest

test/librawspeed/common/MemoryTest.cpp:38–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36static constexpr const size_t alloc_alignment = 16;
37
38template <typename T> class AlignedMallocTest : public testing::Test {
39public:
40 static constexpr const size_t alloc_cnt = 16;
41 static constexpr const size_t alloc_sizeof = sizeof(T);
42 static constexpr const size_t alloc_size = alloc_cnt * alloc_sizeof;
43
44 inline void TheTest(T* ptr) {
45 ASSERT_TRUE(((uintptr_t)ptr % alloc_alignment) == 0);
46 ptr[0] = 0;
47 ptr[1] = 8;
48 ptr[2] = 16;
49 ptr[3] = 24;
50 ptr[4] = 32;
51 ptr[5] = 40;
52 ptr[6] = 48;
53 ptr[7] = 56;
54 ptr[8] = 64;
55 ptr[9] = 72;
56 ptr[10] = 80;
57 ptr[11] = 88;
58 ptr[12] = 96;
59 ptr[13] = 104;
60 ptr[14] = 112;
61 ptr[15] = 120;
62
63 ASSERT_EQ((int64_t)ptr[0] + ptr[1] + ptr[2] + ptr[3] + ptr[4] + ptr[5] +
64 ptr[6] + ptr[7] + ptr[8] + ptr[9] + ptr[10] + ptr[11] +
65 ptr[12] + ptr[13] + ptr[14] + ptr[15],
66 960UL);
67 }
68};
69
70template <typename T>
71class AlignedMallocDeathTest : public AlignedMallocTest<T> {};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected