mirror of
https://github.com/Noratrieb/vechonk.git
synced 2026-01-16 17:45:13 +01:00
portable tests
This commit is contained in:
parent
c71158bcf5
commit
1d4ca0bcda
1 changed files with 4 additions and 2 deletions
|
|
@ -5,6 +5,8 @@ use core::{cmp::Ordering, hash::Hash};
|
||||||
use crate::{vechonk, Vechonk};
|
use crate::{vechonk, Vechonk};
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
|
||||||
|
const USIZE_BYTES: usize = (usize::BITS / 8) as usize;
|
||||||
|
|
||||||
#[repr(align(2048))]
|
#[repr(align(2048))]
|
||||||
struct BigAlign(u8);
|
struct BigAlign(u8);
|
||||||
|
|
||||||
|
|
@ -82,7 +84,7 @@ fn push_two_sized_elem() {
|
||||||
|
|
||||||
assert_eq!(chonk.len(), 2);
|
assert_eq!(chonk.len(), 2);
|
||||||
assert_eq!(chonk.raw.elem_size, 2);
|
assert_eq!(chonk.raw.elem_size, 2);
|
||||||
assert_eq!(chonk.raw.data_section_size(), 16); // two indecies
|
assert_eq!(chonk.raw.data_section_size(), USIZE_BYTES * 2); // two indecies
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -94,7 +96,7 @@ fn push_two_unsized_elem() {
|
||||||
|
|
||||||
assert_eq!(chonk.len(), 2);
|
assert_eq!(chonk.len(), 2);
|
||||||
assert_eq!(chonk.raw.elem_size, 8);
|
assert_eq!(chonk.raw.elem_size, 8);
|
||||||
assert_eq!(chonk.raw.data_section_size(), 32); // two indecies + lengths
|
assert_eq!(chonk.raw.data_section_size(), USIZE_BYTES * 4); // two indecies + lengths
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue