Skip to content

Commit

Permalink
[zdx_simple_arena][zdx_string_view] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zeusdeux committed May 27, 2024
1 parent 0a15ba2 commit 4e7449a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/zdx_simple_arena_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,11 @@ int main(void)
assertm(arena.err, "Expected: arena to have an error %s -> %s, Received: %s", arena.err, strerror(errno), arena.err);
assertm(arena.offset == 0, "Expected: arena offset to be 0, Received: %zu", arena.offset);

arena_reset(&arena);

/* test invalid old size path */
int *valid = arena_realloc(&arena, NULL, 0, sizeof(int) * 8);
c = arena_realloc(&arena, valid, 0, 20);
c = arena_realloc(&arena, valid, 0, 20); // this should fail as the pointer is not NULL but old size is invalid (0)
assertm(c == NULL, "Expected: arena_realloc to fail due to old size being 0, Received: new ptr %p", (void *)c);
assertm(arena.err, "Expected: arena to have an error %s -> %s, Received: %s", arena.err, strerror(errno), arena.err);
assertm(arena.offset == sizeof(int) * 8, "Expected: arena offset to be 0, Received: %zu", arena.offset);
Expand Down
1 change: 0 additions & 1 deletion tests/zdx_string_view_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ int main(void)
"000"
};
expected_chunk = sv_split_by_char(&sv, '.');
printf("expected "SV_FMT"\n", sv_fmt_args(expected_chunk));
for (size_t i = 0; expected_chunk.buf; i++) {
sv_t expected_sv = sv_from_cstr(expected_chunks[i]);

Expand Down

0 comments on commit 4e7449a

Please sign in to comment.