added simple tests in tests/cpp for cpp interface draft
authorPaul Brossier <piem@piem.org>
Tue, 4 Dec 2007 17:15:34 +0000 (18:15 +0100)
committerPaul Brossier <piem@piem.org>
Tue, 4 Dec 2007 17:15:34 +0000 (18:15 +0100)
configure.ac
tests/Makefile.am
tests/cpp/Makefile.am [new file with mode: 0644]
tests/cpp/test-cvec.cpp [new file with mode: 0644]
tests/cpp/test-fvec.cpp [new file with mode: 0644]

index d085555d05fbcb2dc454bfb1ebabaadd86dab5a5..ac299f8247c684ef7a8375947e0b1c873c576635 100644 (file)
@@ -252,6 +252,7 @@ AC_OUTPUT([
     examples/Makefile
     tests/Makefile
     tests/src/Makefile
+    tests/cpp/Makefile
     sounds/Makefile
     swig/Makefile
     python/Makefile
index c72fea3c7a58444fb5e3bef1fbbfa590599a3316..284d5ce3c358daeb03f554c5705a2ad058eb174f 100644 (file)
@@ -1,3 +1,3 @@
 if COMPILE_TESTS 
-SUBDIRS = src 
+SUBDIRS = src cpp
 endif
diff --git a/tests/cpp/Makefile.am b/tests/cpp/Makefile.am
new file mode 100644 (file)
index 0000000..c017215
--- /dev/null
@@ -0,0 +1,15 @@
+AM_CXXFLAGS = -I$(top_srcdir)/cpp -I$(top_srcdir)/src
+AM_LDFLAGS = -L$(top_builddir)/cpp -laubiocpp -L$(top_builddir)/src -laubio @FFTWLIB_LIBS@
+
+bin_PROGRAMS = \
+       test-fvec \
+       test-cvec
+
+test_fvec_SOURCES = test-fvec.cpp
+test_cvec_SOURCES = test-cvec.cpp
+
+run-tests: $(bin_PROGRAMS)
+       @for i in $(bin_PROGRAMS); do echo $$i; ((time ./$$i 2>&1 > /dev/null) 2>&1; echo $$?); done
+
+run-valgrind-tests: $(bin_PROGRAMS)
+       @for i in $(bin_PROGRAMS); do echo $$i; valgrind .libs/lt-$$i 2>&1 | grep ERROR\ SUMMARY -A4; echo $$?; done
diff --git a/tests/cpp/test-cvec.cpp b/tests/cpp/test-cvec.cpp
new file mode 100644 (file)
index 0000000..32a27f5
--- /dev/null
@@ -0,0 +1,21 @@
+#include <iostream>
+#include <aubiocpp.h>
+
+using namespace std;
+using namespace aubio;
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        cvec c = cvec(win_s, channels); /* input buffer */
+        cout << c.norm[0][0] << endl;
+        c.norm[0][0] = 2.;
+        cout << c.norm[0][0] << endl;
+        cout << c.phas[0][0] << endl;
+        c.phas[0][0] = 2.;
+        cout << c.phas[0][0] << endl;
+        return 0;
+}
+
+
diff --git a/tests/cpp/test-fvec.cpp b/tests/cpp/test-fvec.cpp
new file mode 100644 (file)
index 0000000..865c472
--- /dev/null
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <aubiocpp.h>
+
+using namespace std;
+using namespace aubio;
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec f = fvec(win_s, channels); /* input buffer */
+        cout << f[0][0] << endl;
+        f[0][0] = 2.;
+        cout << f[0][0] << endl;
+        return 0;
+}
+