From 2abc107b24f73b8c4664189c34196d9a27a3e339 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 16 Jun 2018 18:05:00 +0200 Subject: Port the rest of the unittests to DGUnit and remove the CppUnit dependency. --- test/audiocachetest.cc | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'test/audiocachetest.cc') diff --git a/test/audiocachetest.cc b/test/audiocachetest.cc index c03bee4..9f5a858 100644 --- a/test/audiocachetest.cc +++ b/test/audiocachetest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include "dgunit.h" #include #include @@ -38,21 +38,19 @@ #define FRAMESIZE 64 class AudioCacheTest - : public CppUnit::TestFixture + : public DGUnit { - CPPUNIT_TEST_SUITE(AudioCacheTest); - CPPUNIT_TEST(singleChannelNonThreaded); - CPPUNIT_TEST(singleChannelThreaded); - CPPUNIT_TEST(multiChannelNonThreaded); - CPPUNIT_TEST(multiChannelThreaded); - CPPUNIT_TEST_SUITE_END(); +public: + AudioCacheTest() + { + DGUNIT_TEST(AudioCacheTest::singleChannelNonThreaded); + DGUNIT_TEST(AudioCacheTest::singleChannelThreaded); + DGUNIT_TEST(AudioCacheTest::multiChannelNonThreaded); + DGUNIT_TEST(AudioCacheTest::multiChannelThreaded); + } DrumkitCreator drumkit_creator; -public: - void setUp() {} - void tearDown() {} - //! Test runner. //! \param filename The name of the file to read. //! \param channel The channel number to do comparison on. @@ -97,7 +95,7 @@ public: // Test pre cache: for(size_t i = 0; i < size; ++i) { - CPPUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); + DGUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); ++offset; } @@ -113,14 +111,14 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(1)); if(--timeout == 0) { - CPPUNIT_ASSERT(false); // timeout + DGUNIT_ASSERT(false); // timeout } } } samples = audio_cache.next(id, size); - CPPUNIT_ASSERT_EQUAL(std::size_t(0), settings.number_of_underruns.load()); + DGUNIT_ASSERT_EQUAL(std::size_t(0), settings.number_of_underruns.load()); for(size_t i = 0; (i < size) && (offset < audio_file_ref.size); ++i) { @@ -132,7 +130,7 @@ public: (int)(audio_file_ref.size - offset), (int)i, (int)size, (int)(size - i)); } - CPPUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); + DGUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); ++offset; } } @@ -202,4 +200,4 @@ public: }; // Registers the fixture into the 'registry' -CPPUNIT_TEST_SUITE_REGISTRATION(AudioCacheTest); +static AudioCacheTest test; -- cgit v1.2.3