diff options
Diffstat (limited to 'libs/ardour/test')
-rw-r--r-- | libs/ardour/test/resampled_source.cc | 31 | ||||
-rw-r--r-- | libs/ardour/test/resampled_source.h | 12 | ||||
-rwxr-xr-x | libs/ardour/test/test.wav | bin | 0 -> 17720 bytes |
3 files changed, 43 insertions, 0 deletions
diff --git a/libs/ardour/test/resampled_source.cc b/libs/ardour/test/resampled_source.cc new file mode 100644 index 0000000000..02bd7ff1a8 --- /dev/null +++ b/libs/ardour/test/resampled_source.cc @@ -0,0 +1,31 @@ +#include "ardour/resampled_source.h" +#include "ardour/sndfileimportable.h" +#include "resampled_source.h" + +CPPUNIT_TEST_SUITE_REGISTRATION (ResampledSourceTest); + +using namespace ARDOUR; + +void +ResampledSourceTest::seekTest () +{ + boost::shared_ptr<SndFileImportableSource> s (new SndFileImportableSource ("../../libs/ardour/test/test.wav")); + ResampledImportableSource r (s, 48000, SrcBest); + + /* Make sure that seek (0) has the desired effect, ie that + given the same input you get the same output after seek (0) + as you got when the Source was newly created. + */ + + Sample A[64]; + r.read (A, 64); + + r.seek (0); + + Sample B[64]; + r.read (B, 64); + + for (int i = 0; i < 64; ++i) { + CPPUNIT_ASSERT (A[i] == B[i]); + } +} diff --git a/libs/ardour/test/resampled_source.h b/libs/ardour/test/resampled_source.h new file mode 100644 index 0000000000..c836968987 --- /dev/null +++ b/libs/ardour/test/resampled_source.h @@ -0,0 +1,12 @@ +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +class ResampledSourceTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE (ResampledSourceTest); + CPPUNIT_TEST (seekTest); + CPPUNIT_TEST_SUITE_END (); + +public: + void seekTest (); +}; diff --git a/libs/ardour/test/test.wav b/libs/ardour/test/test.wav Binary files differnew file mode 100755 index 0000000000..369531cc91 --- /dev/null +++ b/libs/ardour/test/test.wav |