shithub: aubio

Download patch

ref: da67922de5df2d993ede7ecccbfc7c9fec234b78
parent: b610be5271280b1eaefb00f6bb7272a4123092f4
author: Paul Brossier <piem@piem.org>
date: Thu Nov 29 11:11:15 EST 2018

[tests] use run_on_default_source in all source tests

--- a/tests/src/io/test-source_apple_audio.c
+++ b/tests/src/io/test-source_apple_audio.c
@@ -9,8 +9,8 @@
 {
   uint_t err = 0;
   if (argc < 2) {
-    err = 2;
-    PRINT_ERR("not enough arguments\n");
+    PRINT_ERR("not enough arguments, running tests\n");
+    err = run_on_default_source(main);
     PRINT_MSG("read a wave file as a mono vector\n");
     PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     PRINT_MSG("examples:\n");
@@ -56,7 +56,7 @@
   del_aubio_source_apple_audio (s);
 beach:
 #else /* HAVE_SOURCE_APPLE_AUDIO */
-  err = 3;
+  err = 0;
   PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
 #endif /* HAVE_SOURCE_APPLE_AUDIO */
   return err;
--- a/tests/src/io/test-source_avcodec.c
+++ b/tests/src/io/test-source_avcodec.c
@@ -9,8 +9,8 @@
 {
   uint_t err = 0;
   if (argc < 2) {
-    err = 2;
-    PRINT_ERR("not enough arguments\n");
+    PRINT_ERR("not enough arguments, running tests\n");
+    err = run_on_default_source(main);
     PRINT_MSG("read a wave file as a mono vector\n");
     PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     PRINT_MSG("examples:\n");
@@ -56,7 +56,7 @@
   del_aubio_source_avcodec (s);
 beach:
 #else /* HAVE_LIBAV */
-  err = 3;
+  err = 0;
   PRINT_ERR("aubio was not compiled with aubio_source_avcodec\n");
 #endif /* HAVE_LIBAV */
   return err;
--- a/tests/src/io/test-source_multi.c
+++ b/tests/src/io/test-source_multi.c
@@ -5,8 +5,8 @@
 {
   sint_t err = 0;
   if (argc < 2) {
-    err = -2;
-    PRINT_ERR("not enough arguments\n");
+    PRINT_ERR("not enough arguments, running tests\n");
+    err = run_on_default_source(main);
     PRINT_MSG("read a wave file as a mono vector\n");
     PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     PRINT_MSG("examples:\n");
--- a/tests/src/io/test-source_seek.c
+++ b/tests/src/io/test-source_seek.c
@@ -5,8 +5,8 @@
 {
   uint_t err = 0;
   if (argc < 2) {
-    err = 2;
-    PRINT_ERR("not enough arguments\n");
+    PRINT_ERR("not enough arguments, running tests\n");
+    err = run_on_default_source(main);
     PRINT_MSG("read a wave file as a mono vector\n");
     PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     PRINT_MSG("examples:\n");
--- a/tests/src/io/test-source_sndfile.c
+++ b/tests/src/io/test-source_sndfile.c
@@ -9,8 +9,8 @@
 {
   uint_t err = 0;
   if (argc < 2) {
-    err = 2;
-    PRINT_ERR("not enough arguments\n");
+    PRINT_ERR("not enough arguments, running tests\n");
+    err = run_on_default_source(main);
     PRINT_MSG("read a wave file as a mono vector\n");
     PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     PRINT_MSG("examples:\n");
@@ -56,7 +56,7 @@
   del_aubio_source_sndfile (s);
 beach:
 #else
-  err = 3;
+  err = 0;
   PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
 #endif /* HAVE_SNDFILE */
   return err;
--- a/tests/src/io/test-source_wavread.c
+++ b/tests/src/io/test-source_wavread.c
@@ -9,8 +9,8 @@
 {
   uint_t err = 0;
   if (argc < 2) {
-    err = 2;
-    PRINT_ERR("not enough arguments\n");
+    PRINT_ERR("not enough arguments, running tests\n");
+    err = run_on_default_source(main);
     PRINT_MSG("read a wave file as a mono vector\n");
     PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     PRINT_MSG("examples:\n");
@@ -35,7 +35,6 @@
 
   aubio_source_wavread_t * s =
     new_aubio_source_wavread(source_path, samplerate, hop_size);
-
   if (!s) { err = 1; goto beach; }
   fvec_t *vec = new_fvec(hop_size);
 
@@ -57,7 +56,7 @@
   del_aubio_source_wavread (s);
 beach:
 #else
-  err = 3;
+  err = 0;
   PRINT_ERR("aubio was not compiled with aubio_source_wavread\n");
 #endif /* HAVE_WAVREAD */
   return err;