ref: ed339a1fd7593e0596e238d5d624f47de51fc714
parent: bb2f63609a0112ed1e3b2bf2041260ab22fc4b12
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Feb 25 03:25:47 EST 2021
tests: fix a warning; make ASSERT macro print the failed expression; print filename on failed test
--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -177,10 +177,7 @@
static int progress_cb(void *user_data, size_t file_size, uint64_t offset, mp3dec_frame_info_t *info)
{
- (void)user_data;
- (void)file_size;
- (void)offset;
- (void)info;
+ USED(user_data, file_size, offset, info);
return MP3D_E_USER;
}
@@ -457,7 +454,7 @@
fclose(file);
int samples = mp3dec_decode_frame(&mp3d, buf, size, 0, &frame_info);
free(buf);
-#define ASSERT(c) if (!(c)) { printf("failed, line=%d\n", __LINE__); exit(1); }
+#define ASSERT(c) if (!(c)) { printf("ASSERT(%s) failed (line %d)\n", #c, __LINE__); exit(1); }
ASSERT(1152 == samples);
ret = mp3dec_detect_buf(0, size);
@@ -561,7 +558,11 @@
memset(&mp3d, 0xff, sizeof(mp3d));
memset(&finfo, 0xff, sizeof(finfo));
ret = mp3dec_load(&mp3d, input_file_name, &finfo, progress_cb, 0);
- ASSERT(MP3D_E_USER == ret && 2304 == finfo.samples && 44100 == finfo.hz && 2 == finfo.channels && 3 == finfo.layer);
+ ASSERT(MP3D_E_USER == ret);
+ ASSERT(2304 == finfo.samples);
+ ASSERT(44100 == finfo.hz);
+ ASSERT(2 == finfo.channels);
+ ASSERT(3 == finfo.layer);
ASSERT(NULL != finfo.buffer);
free(finfo.buffer);
--- a/mkfile
+++ b/mkfile
@@ -12,7 +12,7 @@
test: $O.minimp3_test
for(f in vectors/*.bit){
- ./$O.minimp3_test $f `{echo -n $f | sed 's/bit$/pcm/'}
+ ./$O.minimp3_test $f `{echo -n $f | sed 's/bit$/pcm/'} || echo $f: FAILED
}
</sys/src/cmd/mkmany