aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pcm_dither.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-16 21:55:00 +0200
committerMax Kellermann <max@duempel.org>2013-10-16 23:36:36 +0200
commit401a799a1b5de5d70a6b4c1d49235af0d5618f37 (patch)
tree503db86df98400dac818fa3bbfbe20e2055a1fa4 /test/test_pcm_dither.cxx
parentba98518c69d0501e67ef707f0d718cc678851415 (diff)
downloadmpd-401a799a1b5de5d70a6b4c1d49235af0d5618f37.tar.gz
mpd-401a799a1b5de5d70a6b4c1d49235af0d5618f37.tar.xz
mpd-401a799a1b5de5d70a6b4c1d49235af0d5618f37.zip
test: use the CPPUNIT framework for unit tests
Diffstat (limited to 'test/test_pcm_dither.cxx')
-rw-r--r--test/test_pcm_dither.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/test_pcm_dither.cxx b/test/test_pcm_dither.cxx
index 5694c17f8..5df64c2d1 100644
--- a/test/test_pcm_dither.cxx
+++ b/test/test_pcm_dither.cxx
@@ -21,10 +21,8 @@
#include "test_pcm_util.hxx"
#include "pcm/PcmDither.hxx"
-#include <glib.h>
-
void
-test_pcm_dither_24()
+PcmDitherTest::TestDither24()
{
constexpr unsigned N = 256;
const auto src = TestDataBuffer<int32_t, N>(GlibRandomInt24());
@@ -34,13 +32,13 @@ test_pcm_dither_24()
dither.Dither24To16(dest, src.begin(), src.end());
for (unsigned i = 0; i < N; ++i) {
- g_assert_cmpint(dest[i], >=, (src[i] >> 8) - 8);
- g_assert_cmpint(dest[i], <, (src[i] >> 8) + 8);
+ CPPUNIT_ASSERT(dest[i] >= (src[i] >> 8) - 8);
+ CPPUNIT_ASSERT(dest[i] < (src[i] >> 8) + 8);
}
}
void
-test_pcm_dither_32()
+PcmDitherTest::TestDither32()
{
constexpr unsigned N = 256;
const auto src = TestDataBuffer<int32_t, N>();
@@ -50,7 +48,7 @@ test_pcm_dither_32()
dither.Dither32To16(dest, src.begin(), src.end());
for (unsigned i = 0; i < N; ++i) {
- g_assert_cmpint(dest[i], >=, (src[i] >> 16) - 8);
- g_assert_cmpint(dest[i], <, (src[i] >> 16) + 8);
+ CPPUNIT_ASSERT(dest[i] >= (src[i] >> 16) - 8);
+ CPPUNIT_ASSERT(dest[i] < (src[i] >> 16) + 8);
}
}