aboutsummaryrefslogtreecommitdiff
path: root/common/object/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'common/object/src/tests.rs')
-rw-r--r--common/object/src/tests.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/object/src/tests.rs b/common/object/src/tests.rs
index 35a29ba..143782c 100644
--- a/common/object/src/tests.rs
+++ b/common/object/src/tests.rs
@@ -37,3 +37,15 @@ fn read_multi_field() {
assert_eq!(friends.next(), Some("Charlie"));
assert_eq!(friends.next(), None);
}
+
+#[test]
+fn vec_align_test() {
+ let mut c = 0;
+ for _ in 0..10_000 {
+ let x = Vec::<u8>::with_capacity(16);
+ if x.as_ptr().align_offset(4) == 0 {
+ c += 1;
+ }
+ }
+ assert_eq!(c, 10_000, "correctly aligned vecs by system allocator")
+}