summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Justfile2
-rw-r--r--README.md39
-rw-r--r--tests/smrt_arena.c10
-rw-r--r--tests/string.c2
-rw-r--r--tests/wav.c8
5 files changed, 29 insertions, 32 deletions
diff --git a/Justfile b/Justfile
index e0834e4..7a2547d 100644
--- a/Justfile
+++ b/Justfile
@@ -87,7 +87,7 @@ test-all: (gen-version "debug")
coverage: (gen-version "debug")
mkdir -p {{build_dir}}/cov-src {{build_dir}}/cov-tests
cd {{build_dir}}/cov-src && {{cc}} {{cflags}} --coverage -c ../../{{src_dir}}/unity.c
- cd {{build_dir}}/cov-tests && {{cc}} {{cflags}} --coverage -c ../../{{test_dir}}/unity.c
+ cd {{build_dir}}/cov-tests && {{cc}} {{cflags}} --coverage -c ../../{{test_dir}}/*.c
{{cc}} {{cflags}} --coverage {{build_dir}}/cov-src/*.o {{build_dir}}/cov-tests/*.o -o {{build_dir}}/test-coverage -lcriterion {{lflags}}
./{{build_dir}}/test-coverage
gcovr --root . --filter '{{src_dir}}/' {{build_dir}}/cov-src --html-details {{build_dir}}/coverage.html --print-summary
diff --git a/README.md b/README.md
index 09342c6..1010836 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,23 @@
# SteEZ (Steven-NA EZ library)
## Todo
-- [x] Add allocation checks and trace log calls (disabled with NLOG_TRACE)
- - [x] deque
- - [x] ez_arena
- - [x] smrt_arena
- - [x] slidingwindow
- - [x] string
- - [x] threadpool
- - [x] vec2sw
- - [x] wav
- [x] Add strng_view
- - want start, end, max_len, char*
- [ ] Write all the procs I want
- - [ ] Test coverage
-- [x] Make status return values consistent. i64, 0 success, -1 fail, >0 info if necessary
- - [x] Deque enqueue (both)
- - [x] smrt_arena_pop_to_mark
- - [x] strng_set
- - [x] write_wav_file
-- [ ] Finish thread_pool
- - [ ] make some tests for it
- - [x] base implementation done
- - [x] Note: there is a crash that occurs regularly, but not when running in debug, (a junk data pointer being passed arond that is zeroed out in debug?)
- - Race condition fixed in commit d3e8a23
+- [ ] Test coverage
+ - [ ] Deque
+ - [ ] Create
+ - [ ] enqueue
+ - [ ] pop
+ - [ ] ts create
+ - [ ] ts enqueue
+ - [ ] ts pop
+ - [ ] logging
+ - [ ] slidingwindow
+ - [ ] create
+ - [ ] insert
+ - [ ] string
+ - [ ] strng_t
+ - [ ] strng_view_t
+ - [ ] thread_pool
+ - [ ] vec2sw
+ - [ ] version.c
diff --git a/tests/smrt_arena.c b/tests/smrt_arena.c
index 505a5e0..1fececf 100644
--- a/tests/smrt_arena.c
+++ b/tests/smrt_arena.c
@@ -222,7 +222,7 @@ Test(smrt_arena, pop_to_mark_restores_position) {
b32 popped = smrt_arena_pop_to_mark(arena);
uint32_t *j = smrt_arena_push(arena, sizeof(uint32_t), true);
- cr_expect_eq(popped, true);
+ cr_expect_eq(popped, 0);
cr_assert_eq(i, j);
smrt_arena_destroy(arena);
@@ -239,7 +239,7 @@ Test(smrt_arena, mark_at_base_position_is_valid) {
b32 popped = smrt_arena_pop_to_mark(arena);
- cr_expect_eq(popped, true);
+ cr_expect_eq(popped, 0);
cr_expect_eq(arena->pos, SMRT_ARENA_BASE_POS);
smrt_arena_destroy(arena);
@@ -252,7 +252,7 @@ Test(smrt_arena, pop_to_mark_without_mark_fails) {
b32 popped = smrt_arena_pop_to_mark(arena);
- cr_expect_eq(popped, false);
+ cr_expect_eq(popped, -1);
smrt_arena_destroy(arena);
}
@@ -342,8 +342,8 @@ Test(smrt_arena, auto_decommit_pop_past_mark_resets_mark) {
cr_expect_lt(arena->commit_pos, mark_pos);
cr_expect_eq(arena->mark_pos, 0);
- b32 popped = smrt_arena_pop_to_mark(arena);
- cr_expect_eq(popped, false);
+ i32 popped = smrt_arena_pop_to_mark(arena);
+ cr_expect_eq(popped, -1);
smrt_arena_destroy(arena);
}
diff --git a/tests/string.c b/tests/string.c
index d106380..e38994e 100644
--- a/tests/string.c
+++ b/tests/string.c
@@ -104,7 +104,7 @@ Test(string, set_string_too_large_fails) {
b32 ok = strng_set(s, "way too long for a 4 byte buffer");
- cr_expect_eq(ok, false);
+ cr_expect_eq(ok, -1);
cr_expect_eq(s->len, 0);
smrt_arena_destroy(arena);
diff --git a/tests/wav.c b/tests/wav.c
index 7635223..6a853dd 100644
--- a/tests/wav.c
+++ b/tests/wav.c
@@ -262,7 +262,7 @@ Test(wav, read_rejects_non_pcm_format, .init = non_pcm_setup, .fini = non_pcm_te
wav_fmt_chunk_t fmtchunk = make_wav_fmt_chunk(1, 8000, 8);
fmtchunk.audio_format = 6; // A-law, neither PCM integer (1) nor IEEE float (3)
- cr_assert(write_wav_file(wav_file, &fmtchunk, data));
+ cr_assert(write_wav_file(wav_file, &fmtchunk, data) == 0);
fclose(wav_file);
@@ -303,7 +303,7 @@ Test(wav, write_sine, .init = write_sine_setup, .fini = write_sine_teardown) {
wav_fmt_chunk_t fmtchunk = make_wav_fmt_chunk(1, sample_count, 8);
- cr_assert(write_wav_file(wav_file, &fmtchunk, data));
+ cr_assert(write_wav_file(wav_file, &fmtchunk, data) == 0);
fclose(wav_file);
@@ -370,7 +370,7 @@ Test(wav, read_32bps_float_round_trip, .init = float32_wav_setup, .fini = float3
wav_fmt_chunk_t fmtchunk = make_wav_fmt_chunk(1, 44100, 32);
fmtchunk.audio_format = 3; // IEEE 754 float
- cr_assert(write_wav_file(wav_file, &fmtchunk, data));
+ cr_assert(write_wav_file(wav_file, &fmtchunk, data) == 0);
fclose(wav_file);
@@ -435,7 +435,7 @@ Test(wav, read_24bps_round_trip, .init = pcm24_wav_setup, .fini = pcm24_wav_tear
wav_fmt_chunk_t fmtchunk = make_wav_fmt_chunk(1, 44100, 24);
- cr_assert(write_wav_file(wav_file, &fmtchunk, data));
+ cr_assert(write_wav_file(wav_file, &fmtchunk, data) == 0);
fclose(wav_file);