1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 23:29:16 +00:00

Explicit test that memory (plus others) are zeroed

This commit is contained in:
Peter Evans 2017-12-12 14:45:06 -06:00
parent da62ac4ca6
commit 0bcf9e006d

View File

@ -5,12 +5,20 @@
Test(vm_segment, create) {
vm_segment *segment;
int length = 128;
int i;
segment = vm_segment_create(length);
cr_assert_neq(segment, NULL);
cr_assert_eq(segment->size, length);
// Test that the memory chunk itself, plus the read and write
// tables, are all zeroed out.
for (i = 0; i < segment->size; i++) {
cr_assert_eq(segment->memory[i], 0);
cr_assert_eq(segment->read_table[i], NULL);
cr_assert_eq(segment->write_table[i], NULL);
}
vm_segment_free(segment);
}