shithub: mp3dec

Download patch

ref: fa0f80b703643b202ff5f0952b3a2cdc226317f1
parent: 9229f280ad475a434d7592255dc01534db65504f
author: lieff <lieff@users.noreply.github.com>
date: Sat Feb 22 18:18:16 EST 2020

test: improve coverage

--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -334,13 +334,6 @@
         fwrite(wav_header(info.hz, info.channels, 16, data_bytes), 1, 44, file_out);
     }
 #endif
-#ifdef MP4_MODE
-    if (!total_samples)
-    {
-        printf("error: mp4 test should decode some samples\n");
-        exit(1);
-    }
-#endif
 }
 
 #ifdef LIBFUZZER
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -10,7 +10,7 @@
 -ffunction-sections -fdata-sections -Wl,--gc-sections"
 
 echo testing mp4 mode...
-gcc $CFLAGS -DMP4_MODE -o minimp3 minimp3_test.c -lm
+gcc $CFLAGS -o minimp3 minimp3_test.c -lm
 scripts/test_mode.sh 3 0 0
 
 echo testing stream mode...
@@ -51,6 +51,9 @@
 [[ "$(./minimp3 -m 8 -e 3 vectors/l3-sin1k0db.bit)" != "error: mp3dec_ex_open()=-3 failed" ]] && echo fail && exit 1 || echo pass
 [[ "$(./minimp3 -m 8 -e 4 vectors/l3-sin1k0db.bit)" != "error: mp3dec_ex_open()=-3 failed" ]] && echo fail && exit 1 || echo pass
 [[ "$(./minimp3 -m 8 -e 5 vectors/l3-sin1k0db.bit)" != "error: mp3dec_ex_read() readed less than expected, last_error=-5" ]] && echo fail && exit 1 || echo pass
+
+[[ "$(./minimp3 vectors/l3-nonstandard-id3v2-only.bit vectors/l3-nonstandard-id3v2-only.pcm)" != "rate=0 samples=0 max_diff=0 PSNR=99.000000" ]] && echo fail && exit 1 || echo pass
+[[ "$(./minimp3 -m 3 vectors/l3-nonstandard-id3v2-only.bit vectors/l3-nonstandard-id3v2-only.pcm)" != "rate=0 samples=0 max_diff=0 PSNR=99.000000" ]] && echo fail && exit 1 || echo pass
 set -e
 gcov minimp3_test.c
 
binary files /dev/null b/vectors/l3-nonstandard-id3v2-only.bit differ