shithub: mp3dec

Download patch

ref: 87180cbdb314a2e3f583b88c43eb8f458a861ef8
parent: 4284990e59037f39179e895f95f07ef59837e812
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Dec 28 11:26:10 EST 2020

run tests on mk test

--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -1,3 +1,20 @@
+#ifdef __plan9__
+#include <u.h>
+#include <libc.h>
+#define strcasecmp cistrcmp
+#define exit(x) exits(x ? "failed" : nil)
+#define RAND_MAX 32767
+#else
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <time.h>
+#if defined(_MSC_VER)
+    #define strcasecmp(str1, str2) _strnicmp(str1, str2, strlen(str2))
+#else
+    #include <strings.h>
+#endif
+#endif
 #ifdef MINIMP3_TEST
 static int malloc_num = 0, fail_malloc_num = -1;
 #include <stdio.h>
@@ -38,15 +55,6 @@
 #define MINIMP3_IMPLEMENTATION
 #define MINIMP3_ALLOW_MONO_STEREO_TRANSITION
 #include "minimp3_ex.h"
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <time.h>
-#if defined(_MSC_VER)
-    #define strcasecmp(str1, str2) _strnicmp(str1, str2, strlen(str2))
-#else
-    #include <strings.h>
-#endif
 
 #define MODE_LOAD     0
 #define MODE_LOAD_BUF 1
@@ -681,6 +689,9 @@
         free(buf_ref);
     if (file_out)
         fclose(file_out);
+#ifdef __plan9__
+	exits(nil);
+#endif
     return 0;
 }
 
--- a/mkfile
+++ b/mkfile
@@ -8,9 +8,11 @@
 	minimp3.h\
 	minimp3_ex.h\
 
-OFILES=\
-	mp3dec.$O\
-
 default:V: all
 
-</sys/src/cmd/mkone
+test: $O.minimp3_test
+	for(f in vectors/*.bit){
+		./$O.minimp3_test $f `{echo -n $f | sed 's/bit$/pcm/'}
+	}
+
+</sys/src/cmd/mkmany