| 36 | static constexpr const size_t alloc_alignment = 16; |
| 37 | |
| 38 | template <typename T> class AlignedMallocTest : public testing::Test { |
| 39 | public: |
| 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 | |
| 70 | template <typename T> |
| 71 | class AlignedMallocDeathTest : public AlignedMallocTest<T> {}; |
nothing calls this directly
no outgoing calls
no test coverage detected