diff options
| author | steven-na <noreply.github@stvnc.dev> | 2026-07-30 13:58:06 -0700 |
|---|---|---|
| committer | steven-na <noreply.github@stvnc.dev> | 2026-07-30 13:58:06 -0700 |
| commit | a1af7db3ecf1863c77e69aa432e6fb2694ec3f95 (patch) | |
| tree | 1109813dfd46c2db628eb9d03c861dddf41b2a4b /tests/wav.c | |
| parent | 62ae217a27531d9767bcdda0e7ff6c4368ed857e (diff) | |
Wav file loading
Diffstat (limited to 'tests/wav.c')
| -rw-r--r-- | tests/wav.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/wav.c b/tests/wav.c new file mode 100644 index 0000000..aac7f9d --- /dev/null +++ b/tests/wav.c @@ -0,0 +1,27 @@ +#include "../src/wav.h" + +#include <stddef.h> +#include <stdio.h> + +#include <criterion/criterion.h> +#include <criterion/internal/assert.h> +#include <criterion/internal/test.h> +#include <string.h> + +Test(wav, read_file) { + smrt_arena_t *arena = smrt_arena_create(MiB(4), KiB(4), false); + + wav_master_chunk_t mchunk; + wav_fmt_chunk_t fmtchunk; + + wav_data_t *data = load_wav_file(arena, "./tests/fixtures/sine.wav", &mchunk, &fmtchunk); + + u8 idcheck[4] = { 'f', 'm', 't', ' ' }; + cr_expect(memcmp(fmtchunk.chunk_id, idcheck, 4) == 0); + cr_expect(fmtchunk.audio_format == 1); + cr_expect(fmtchunk.num_channels == 1); + cr_expect(fmtchunk.bits_per_sample == 16); + cr_expect(data->sample_count == 48000); + + smrt_arena_destroy(arena); +} |