Index: tests/SmallAllocatorTest.cpp |
diff --git a/tests/SmallAllocatorTest.cpp b/tests/SmallAllocatorTest.cpp |
index 774e0c9e8982906f09def08548e98b2145ce1cf8..7c9172decc1ce5a4c482ff4e5d85737ae2ee440d 100644 |
--- a/tests/SmallAllocatorTest.cpp |
+++ b/tests/SmallAllocatorTest.cpp |
@@ -81,3 +81,16 @@ DEF_TEST(SmallAllocator_pointer, reporter) { |
REPORTER_ASSERT(reporter, container != nullptr); |
REPORTER_ASSERT(reporter, container->getDummy() == &d); |
} |
+ |
+#define check_alignment(reporter, ptr) \ |
+ REPORTER_ASSERT(reporter, SkIsAlign16((intptr_t)ptr)) |
+ |
+DEF_TEST(SmallAllocator_alignment, reporter) { |
+ const size_t totalBytes = 1 + 2 + 4 + 8; |
+ SkSmallAllocator<4, totalBytes> alloc; |
+ |
+ check_alignment(reporter, alloc.reserveT<uint8_t>()); |
+ check_alignment(reporter, alloc.reserveT<uint16_t>()); |
+ check_alignment(reporter, alloc.reserveT<uint32_t>()); |
+ check_alignment(reporter, alloc.reserveT<uint64_t>()); |
+} |