ref: 76c490405cc766244eceb4176d1201f7e9115c2f
parent: 93ef385153cd360f4874648ceb0f3916b97c4a41
author: lieff <[email protected]>
date: Tue Feb 13 18:27:46 EST 2018
add some test coverage
--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -152,7 +152,8 @@
}
FILE *file_mp3 = fopen(input_file_name, "rb");
unsigned char *buf_mp3 = preload(file_mp3, &mp3_size);
- fclose(file_mp3);
+ if (file_mp3)
+ fclose(file_mp3);
if (!buf_mp3 || !mp3_size)
{
printf("error: no mp3 data\n");
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -8,6 +8,10 @@
gcc -coverage -O0 -m32 -std=c89 -msse2 -DMINIMP3_TEST -DMINIMP3_NO_WAV -o minimp3 minimp3_test.c -lm
scripts/test.sh
+set +e
+./minimp3
+./minimp3 do_not_exist
+set -e
gcov minimp3_test.c
gcc -O2 -g -std=c89 -Wall -Wextra -Wmissing-prototypes -Werror -fno-asynchronous-unwind-tables -fno-stack-protector \