Skip to content

Commit

Permalink
Fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ccgargantua committed Jan 6, 2024
1 parent 1f360ac commit 1252afa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ void test_arena_alloc(void)
{
Arena *arena = arena_create(13 + sizeof(long) * 3);
char *char_array = arena_alloc(arena, 13);
long *long_array = arena_alloc(arena, sizeof(long) * 3);
long *long_array;
long expected_long_array[3] = {999, 9999, 99999};
char *should_not_be_allocated = arena_alloc(arena, 1);
char *should_not_be_allocated;

TEST_FATAL(char_array != NULL, "char array allocated from arena was NULL.");
TEST_FATAL(arena->head_allocation != NULL, "Arena's head allocation linked list node was NULL.");
Expand All @@ -153,6 +153,7 @@ void test_arena_alloc(void)

TEST_EQUAL(arena->index, 13);

long_array = arena_alloc(arena, sizeof(long) * 3);
TEST_FATAL(long_array != NULL, "long array allocated from arena was NULL.");

TEST_FATAL(arena->head_allocation->next != NULL, "Link list addition failed.");
Expand All @@ -171,6 +172,7 @@ void test_arena_alloc(void)

TEST_EQUAL(arena_alloc(NULL, 0), NULL);

should_not_be_allocated = arena_alloc(arena, 1);
TEST_EQUAL(should_not_be_allocated, NULL);

arena_destroy(arena);
Expand Down

0 comments on commit 1252afa

Please sign in to comment.