ref: 445e0dca2e40d17fd771f081fd0de39e9d8d01d0
parent: c60d684ebe44c6d8aa22f574fdac7a938c7da7cf
author: Paul Brossier <piem@piem.org>
date: Tue Dec 4 13:15:34 EST 2007
added simple tests in tests/cpp for cpp interface draft
--- a/configure.ac
+++ b/configure.ac
@@ -252,6 +252,7 @@
examples/Makefile
tests/Makefile
tests/src/Makefile
+ tests/cpp/Makefile
sounds/Makefile
swig/Makefile
python/Makefile
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,3 @@
if COMPILE_TESTS
-SUBDIRS = src
+SUBDIRS = src cpp
endif
--- /dev/null
+++ b/tests/cpp/Makefile.am
@@ -1,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
--- /dev/null
+++ b/tests/cpp/test-cvec.cpp
@@ -1,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;
+}
+
+
--- /dev/null
+++ b/tests/cpp/test-fvec.cpp
@@ -1,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;
+}
+