From: Paul Brossier Date: Tue, 4 Dec 2007 17:15:34 +0000 (+0100) Subject: added simple tests in tests/cpp for cpp interface draft X-Git-Tag: bzr2git~407 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=445e0dca2e40d17fd771f081fd0de39e9d8d01d0;p=aubio.git added simple tests in tests/cpp for cpp interface draft --- diff --git a/configure.ac b/configure.ac index d085555d..ac299f82 100644 --- a/configure.ac +++ b/configure.ac @@ -252,6 +252,7 @@ AC_OUTPUT([ examples/Makefile tests/Makefile tests/src/Makefile + tests/cpp/Makefile sounds/Makefile swig/Makefile python/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index c72fea3c..284d5ce3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..c0172157 --- /dev/null +++ b/tests/cpp/Makefile.am @@ -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 index 00000000..32a27f50 --- /dev/null +++ b/tests/cpp/test-cvec.cpp @@ -0,0 +1,21 @@ +#include +#include + +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 index 00000000..865c4728 --- /dev/null +++ b/tests/cpp/test-fvec.cpp @@ -0,0 +1,17 @@ +#include +#include + +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; +} +