summaryrefslogtreecommitdiff
path: root/test/audiocachetest.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-06-16 18:05:00 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-06-16 18:15:59 +0200
commit2abc107b24f73b8c4664189c34196d9a27a3e339 (patch)
treeb7067a45f7294dbd143c410bdfb690157c976e3c /test/audiocachetest.cc
parente694a23ab28686ecc0635c2ac8c625e743b89a3b (diff)
Port the rest of the unittests to DGUnit and remove the CppUnit dependency.
Diffstat (limited to 'test/audiocachetest.cc')
-rw-r--r--test/audiocachetest.cc32
1 files changed, 15 insertions, 17 deletions
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 <cppunit/extensions/HelperMacros.h>
+#include "dgunit.h"
#include <thread>
#include <chrono>
@@ -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;