tests/: move tests around
authorPaul Brossier <piem@piem.org>
Mon, 2 May 2011 10:37:41 +0000 (12:37 +0200)
committerPaul Brossier <piem@piem.org>
Mon, 2 May 2011 10:37:41 +0000 (12:37 +0200)
tests/src/spectral/test-fft.c [new file with mode: 0644]
tests/src/tempo/test-beattracking.c [new file with mode: 0644]
tests/src/tempo/test-tempo.c [new file with mode: 0644]
tests/src/test-beattracking.c [deleted file]
tests/src/test-fft.c [deleted file]
tests/src/test-tempo.c [deleted file]

diff --git a/tests/src/spectral/test-fft.c b/tests/src/spectral/test-fft.c
new file mode 100644 (file)
index 0000000..a17b977
--- /dev/null
@@ -0,0 +1,34 @@
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 8;                       /* window size        */
+        fvec_t * in       = new_fvec (win_s); /* input buffer       */
+        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
+        fvec_t * out      = new_fvec (win_s); /* output buffer      */
+        in->data[0] = 1;
+        in->data[1] = 2;
+        in->data[2] = 3;
+        in->data[3] = 4;
+        in->data[4] = 5;
+        in->data[5] = 6;
+        in->data[6] = 5;
+        in->data[7] = 6;
+        /* allocate fft and other memory space */
+        aubio_fft_t * fft = new_aubio_fft(win_s);
+        /* fill input with some data */
+        fvec_print(in);
+        /* execute stft */
+        aubio_fft_do (fft,in,fftgrain);
+        cvec_print(fftgrain);
+        /* execute inverse fourier transform */
+        aubio_fft_rdo(fft,fftgrain,out);
+        fvec_print(out);
+        del_aubio_fft(fft);
+        del_fvec(in);
+        del_cvec(fftgrain);
+        del_fvec(out);
+        aubio_cleanup();
+        return 0;
+}
diff --git a/tests/src/tempo/test-beattracking.c b/tests/src/tempo/test-beattracking.c
new file mode 100644 (file)
index 0000000..e4ac6dc
--- /dev/null
@@ -0,0 +1,41 @@
+#define AUBIO_UNSTABLE 1
+
+#include <stdio.h>
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        fvec_t * out      = new_fvec (win_s/4);     /* input buffer */
+  
+        /* allocate fft and other memory space */
+        aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s);
+
+        uint_t i = 0;
+
+        smpl_t curtempo, curtempoconf;
+
+        while (i < 10) {
+          aubio_beattracking_do(tempo,in,out);
+          curtempo = aubio_beattracking_get_bpm(tempo);
+          if (curtempo != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          curtempoconf = aubio_beattracking_get_confidence(tempo);
+          if (curtempoconf != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          i++;
+        };
+
+        del_aubio_beattracking(tempo);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
+
diff --git a/tests/src/tempo/test-tempo.c b/tests/src/tempo/test-tempo.c
new file mode 100644 (file)
index 0000000..3a6c283
--- /dev/null
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        fvec_t * out      = new_fvec (2);     /* input buffer */
+        aubio_tempo_t * o  = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
+        uint_t i = 0;
+
+        smpl_t curtempo, curtempoconf;
+
+        while (i < 1000) {
+          aubio_tempo_do(o,in,out);
+          curtempo = aubio_tempo_get_bpm(o);
+          if (curtempo != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          curtempoconf = aubio_tempo_get_confidence(o);
+          if (curtempoconf != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          i++;
+        };
+
+        del_aubio_tempo(o);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
diff --git a/tests/src/test-beattracking.c b/tests/src/test-beattracking.c
deleted file mode 100644 (file)
index e4ac6dc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <stdio.h>
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (win_s/4);     /* input buffer */
-  
-        /* allocate fft and other memory space */
-        aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s);
-
-        uint_t i = 0;
-
-        smpl_t curtempo, curtempoconf;
-
-        while (i < 10) {
-          aubio_beattracking_do(tempo,in,out);
-          curtempo = aubio_beattracking_get_bpm(tempo);
-          if (curtempo != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          curtempoconf = aubio_beattracking_get_confidence(tempo);
-          if (curtempoconf != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          i++;
-        };
-
-        del_aubio_beattracking(tempo);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
-
diff --git a/tests/src/test-fft.c b/tests/src/test-fft.c
deleted file mode 100644 (file)
index a17b977..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 8;                       /* window size        */
-        fvec_t * in       = new_fvec (win_s); /* input buffer       */
-        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
-        fvec_t * out      = new_fvec (win_s); /* output buffer      */
-        in->data[0] = 1;
-        in->data[1] = 2;
-        in->data[2] = 3;
-        in->data[3] = 4;
-        in->data[4] = 5;
-        in->data[5] = 6;
-        in->data[6] = 5;
-        in->data[7] = 6;
-        /* allocate fft and other memory space */
-        aubio_fft_t * fft = new_aubio_fft(win_s);
-        /* fill input with some data */
-        fvec_print(in);
-        /* execute stft */
-        aubio_fft_do (fft,in,fftgrain);
-        cvec_print(fftgrain);
-        /* execute inverse fourier transform */
-        aubio_fft_rdo(fft,fftgrain,out);
-        fvec_print(out);
-        del_aubio_fft(fft);
-        del_fvec(in);
-        del_cvec(fftgrain);
-        del_fvec(out);
-        aubio_cleanup();
-        return 0;
-}
diff --git a/tests/src/test-tempo.c b/tests/src/test-tempo.c
deleted file mode 100644 (file)
index 3a6c283..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <stdio.h>
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (2);     /* input buffer */
-        aubio_tempo_t * o  = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
-        uint_t i = 0;
-
-        smpl_t curtempo, curtempoconf;
-
-        while (i < 1000) {
-          aubio_tempo_do(o,in,out);
-          curtempo = aubio_tempo_get_bpm(o);
-          if (curtempo != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          curtempoconf = aubio_tempo_get_confidence(o);
-          if (curtempoconf != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          i++;
-        };
-
-        del_aubio_tempo(o);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}