From a1af7db3ecf1863c77e69aa432e6fb2694ec3f95 Mon Sep 17 00:00:00 2001 From: steven-na Date: Thu, 30 Jul 2026 13:58:06 -0700 Subject: Wav file loading --- tests/wav.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/wav.c (limited to 'tests/wav.c') 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 +#include + +#include +#include +#include +#include + +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); +} -- cgit v1.2.3