Skip to content

Commit 33ac6af

Browse files
committed
Add second push to test
1 parent 58088dc commit 33ac6af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/tests.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,4 +806,21 @@ fn test_push_uninit() {
806806
assert_eq!(lock[0].field_one[3], 1);
807807
assert_eq!(lock[0].field_two[999], 2);
808808
assert_eq!(lock[0].field_three[999_999], 3);
809+
810+
// Push a second value
811+
let ptr = unsafe { lock.try_push_uninit().unwrap() };
812+
let field_one = unsafe {&mut (*ptr).field_one};
813+
*field_one = [4; 1_000_000];
814+
let field_two = unsafe {&mut (*ptr).field_two};
815+
*field_two = [5; 1_000_000];
816+
let field_three = unsafe {&mut (*ptr).field_three};
817+
*field_three = [6; 1_000_000];
818+
819+
assert_eq!(lock.len(), 2);
820+
assert_eq!(lock[0].field_one[3], 1);
821+
assert_eq!(lock[0].field_two[999], 2);
822+
assert_eq!(lock[0].field_three[999_999], 3);
823+
assert_eq!(lock[1].field_one[3], 4);
824+
assert_eq!(lock[1].field_two[999], 5);
825+
assert_eq!(lock[1].field_three[999_999], 6);
809826
}

0 commit comments

Comments
 (0)