test: use the CPPUNIT framework for unit tests

This commit is contained in:
Max Kellermann 2013-10-16 21:55:00 +02:00
parent ba98518c69
commit 401a799a1b
13 changed files with 308 additions and 237 deletions

View File

@ -1411,9 +1411,11 @@ endif
test_test_byte_reverse_SOURCES = \ test_test_byte_reverse_SOURCES = \
test/test_byte_reverse.cxx test/test_byte_reverse.cxx
test_test_byte_reverse_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUNIT_CFLAGS) -DCPPUNIT_HAVE_RTTI=0
test_test_byte_reverse_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_byte_reverse_LDADD = \ test_test_byte_reverse_LDADD = \
libutil.a \ libutil.a \
$(GLIB_LIBS) $(CPPUNIT_LIBS)
test_test_pcm_SOURCES = \ test_test_pcm_SOURCES = \
test/test_pcm_util.hxx \ test/test_pcm_util.hxx \
@ -1425,18 +1427,23 @@ test_test_pcm_SOURCES = \
test/test_pcm_mix.cxx \ test/test_pcm_mix.cxx \
test/test_pcm_all.hxx \ test/test_pcm_all.hxx \
test/test_pcm_main.cxx test/test_pcm_main.cxx
test_test_pcm_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUNIT_CFLAGS) -DCPPUNIT_HAVE_RTTI=0
test_test_pcm_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_pcm_LDADD = \ test_test_pcm_LDADD = \
$(PCM_LIBS) \ $(PCM_LIBS) \
libutil.a \ libutil.a \
$(CPPUNIT_LIBS) \
$(GLIB_LIBS) $(GLIB_LIBS)
test_test_queue_priority_SOURCES = \ test_test_queue_priority_SOURCES = \
src/Queue.cxx \ src/Queue.cxx \
test/test_queue_priority.cxx test/test_queue_priority.cxx
test_test_queue_priority_CPPFLAGS = $(AM_CPPFLAGS) $(CPPUNIT_CFLAGS) -DCPPUNIT_HAVE_RTTI=0
test_test_queue_priority_CXXFLAGS = $(AM_CXXFLAGS) -Wno-error=deprecated-declarations
test_test_queue_priority_LDADD = \ test_test_queue_priority_LDADD = \
libsystem.a \ libsystem.a \
libutil.a \ libutil.a \
$(GLIB_LIBS) $(CPPUNIT_LIBS)
noinst_PROGRAMS += src/pcm/dsd2pcm/dsd2pcm noinst_PROGRAMS += src/pcm/dsd2pcm/dsd2pcm

View File

@ -1483,6 +1483,12 @@ AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl test suite dnl test suite
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
if test "x$enable_test" = xyes; then
PKG_CHECK_MODULES([CPPUNIT], [cppunit],,
[AC_MSG_ERROR([cppunit not found])])
fi
AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes) AM_CONDITIONAL(ENABLE_TEST, test "x$enable_test" = xyes)
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------

View File

@ -19,11 +19,34 @@
#include "util/ByteReverse.hxx" #include "util/ByteReverse.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "Compiler.h"
#include <glib.h> #include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
static void #include <string.h>
test_byte_reverse_2(void)
class ByteReverseTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(ByteReverseTest);
CPPUNIT_TEST(TestByteReverse2);
CPPUNIT_TEST(TestByteReverse3);
CPPUNIT_TEST(TestByteReverse4);
CPPUNIT_TEST(TestByteReverse5);
CPPUNIT_TEST_SUITE_END();
public:
void TestByteReverse2();
void TestByteReverse3();
void TestByteReverse4();
void TestByteReverse5();
};
CPPUNIT_TEST_SUITE_REGISTRATION(ByteReverseTest);
void
ByteReverseTest::TestByteReverse2()
{ {
static const char src[] = "123456"; static const char src[] = "123456";
static const char result[] = "214365"; static const char result[] = "214365";
@ -31,11 +54,11 @@ test_byte_reverse_2(void)
reverse_bytes(dest, (const uint8_t *)src, reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2); (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 2);
g_assert_cmpstr((const char *)dest, ==, result); CPPUNIT_ASSERT(strcmp(result, (const char *)dest) == 0);
} }
static void void
test_byte_reverse_3(void) ByteReverseTest::TestByteReverse3()
{ {
static const char src[] = "123456"; static const char src[] = "123456";
static const char result[] = "321654"; static const char result[] = "321654";
@ -43,11 +66,11 @@ test_byte_reverse_3(void)
reverse_bytes(dest, (const uint8_t *)src, reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 3); (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 3);
g_assert_cmpstr((const char *)dest, ==, result); CPPUNIT_ASSERT(strcmp(result, (const char *)dest) == 0);
} }
static void void
test_byte_reverse_4(void) ByteReverseTest::TestByteReverse4()
{ {
static const char src[] = "12345678"; static const char src[] = "12345678";
static const char result[] = "43218765"; static const char result[] = "43218765";
@ -55,11 +78,11 @@ test_byte_reverse_4(void)
reverse_bytes(dest, (const uint8_t *)src, reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4); (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 4);
g_assert_cmpstr((const char *)dest, ==, result); CPPUNIT_ASSERT(strcmp(result, (const char *)dest) == 0);
} }
static void void
test_byte_reverse_5(void) ByteReverseTest::TestByteReverse5()
{ {
static const char src[] = "1234567890"; static const char src[] = "1234567890";
static const char result[] = "5432109876"; static const char result[] = "5432109876";
@ -67,17 +90,14 @@ test_byte_reverse_5(void)
reverse_bytes(dest, (const uint8_t *)src, reverse_bytes(dest, (const uint8_t *)src,
(const uint8_t *)(src + ARRAY_SIZE(src) - 1), 5); (const uint8_t *)(src + ARRAY_SIZE(src) - 1), 5);
g_assert_cmpstr((const char *)dest, ==, result); CPPUNIT_ASSERT(strcmp(result, (const char *)dest) == 0);
} }
int int
main(int argc, char **argv) main(gcc_unused int argc, gcc_unused char **argv)
{ {
g_test_init (&argc, &argv, NULL); CppUnit::TextUi::TestRunner runner;
g_test_add_func("/util/byte_reverse/2", test_byte_reverse_2); auto &registry = CppUnit::TestFactoryRegistry::getRegistry();
g_test_add_func("/util/byte_reverse/3", test_byte_reverse_3); runner.addTest(registry.makeTest());
g_test_add_func("/util/byte_reverse/4", test_byte_reverse_4); return runner.run() ? EXIT_SUCCESS : EXIT_FAILURE;
g_test_add_func("/util/byte_reverse/5", test_byte_reverse_5);
g_test_run();
} }

View File

@ -20,61 +20,99 @@
#ifndef MPD_TEST_PCM_ALL_HXX #ifndef MPD_TEST_PCM_ALL_HXX
#define MPD_TEST_PCM_ALL_HXX #define MPD_TEST_PCM_ALL_HXX
void #include <cppunit/TestFixture.h>
test_pcm_dither_24(); #include <cppunit/extensions/HelperMacros.h>
void class PcmDitherTest : public CppUnit::TestFixture {
test_pcm_dither_32(); CPPUNIT_TEST_SUITE(PcmDitherTest);
CPPUNIT_TEST(TestDither24);
CPPUNIT_TEST(TestDither32);
CPPUNIT_TEST_SUITE_END();
void public:
test_pcm_pack_24(); void TestDither24();
void TestDither32();
};
void CPPUNIT_TEST_SUITE_REGISTRATION(PcmDitherTest);
test_pcm_unpack_24();
void class PcmPackTest : public CppUnit::TestFixture {
test_pcm_channels_16(); CPPUNIT_TEST_SUITE(PcmPackTest);
CPPUNIT_TEST(TestPack24);
CPPUNIT_TEST(TestUnpack24);
CPPUNIT_TEST_SUITE_END();
void public:
test_pcm_channels_32(); void TestPack24();
void TestUnpack24();
};
void CPPUNIT_TEST_SUITE_REGISTRATION(PcmPackTest);
test_pcm_volume_8();
void class PcmChannelsTest : public CppUnit::TestFixture {
test_pcm_volume_16(); CPPUNIT_TEST_SUITE(PcmChannelsTest);
CPPUNIT_TEST(TestChannels16);
CPPUNIT_TEST(TestChannels32);
CPPUNIT_TEST_SUITE_END();
void public:
test_pcm_volume_24(); void TestChannels16();
void TestChannels32();
};
void CPPUNIT_TEST_SUITE_REGISTRATION(PcmChannelsTest);
test_pcm_volume_32();
void class PcmVolumeTest : public CppUnit::TestFixture {
test_pcm_volume_float(); CPPUNIT_TEST_SUITE(PcmVolumeTest);
CPPUNIT_TEST(TestVolume8);
CPPUNIT_TEST(TestVolume16);
CPPUNIT_TEST(TestVolume24);
CPPUNIT_TEST(TestVolume32);
CPPUNIT_TEST(TestVolumeFloat);
CPPUNIT_TEST_SUITE_END();
void public:
test_pcm_format_8_to_16(); void TestVolume8();
void TestVolume16();
void TestVolume24();
void TestVolume32();
void TestVolumeFloat();
};
void CPPUNIT_TEST_SUITE_REGISTRATION(PcmVolumeTest);
test_pcm_format_16_to_24();
void class PcmFormatTest : public CppUnit::TestFixture {
test_pcm_format_16_to_32(); CPPUNIT_TEST_SUITE(PcmFormatTest);
CPPUNIT_TEST(TestFormat8to16);
CPPUNIT_TEST(TestFormat16to24);
CPPUNIT_TEST(TestFormat16to32);
CPPUNIT_TEST(TestFormatFloat);
CPPUNIT_TEST_SUITE_END();
void public:
test_pcm_format_float(); void TestFormat8to16();
void TestFormat16to24();
void TestFormat16to32();
void TestFormatFloat();
};
void CPPUNIT_TEST_SUITE_REGISTRATION(PcmFormatTest);
test_pcm_mix_8();
void class PcmMixTest : public CppUnit::TestFixture {
test_pcm_mix_16(); CPPUNIT_TEST_SUITE(PcmMixTest);
CPPUNIT_TEST(TestMix8);
CPPUNIT_TEST(TestMix16);
CPPUNIT_TEST(TestMix24);
CPPUNIT_TEST(TestMix32);
CPPUNIT_TEST_SUITE_END();
void public:
test_pcm_mix_24(); void TestMix8();
void TestMix16();
void TestMix24();
void TestMix32();
};
void CPPUNIT_TEST_SUITE_REGISTRATION(PcmMixTest);
test_pcm_mix_32();
#endif #endif

View File

@ -23,10 +23,8 @@
#include "pcm/PcmChannels.hxx" #include "pcm/PcmChannels.hxx"
#include "pcm/PcmBuffer.hxx" #include "pcm/PcmBuffer.hxx"
#include <glib.h>
void void
test_pcm_channels_16() PcmChannelsTest::TestChannels16()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int16_t, N * 2>(); const auto src = TestDataBuffer<int16_t, N * 2>();
@ -39,26 +37,26 @@ test_pcm_channels_16()
const int16_t *dest = const int16_t *dest =
pcm_convert_channels_16(buffer, 1, 2, src, sizeof(src), pcm_convert_channels_16(buffer, 1, 2, src, sizeof(src),
&dest_size); &dest_size);
g_assert(dest != NULL); CPPUNIT_ASSERT(dest != NULL);
g_assert_cmpint(dest_size, ==, sizeof(src) / 2); CPPUNIT_ASSERT_EQUAL(sizeof(src) / 2, dest_size);
for (unsigned i = 0; i < N; ++i) for (unsigned i = 0; i < N; ++i)
g_assert_cmpint(dest[i], ==, CPPUNIT_ASSERT_EQUAL(int16_t((src[i * 2] + src[i * 2 + 1]) / 2),
(src[i * 2] + src[i * 2 + 1]) / 2); dest[i]);
/* mono to stereo */ /* mono to stereo */
dest = pcm_convert_channels_16(buffer, 2, 1, src, sizeof(src), dest = pcm_convert_channels_16(buffer, 2, 1, src, sizeof(src),
&dest_size); &dest_size);
g_assert(dest != NULL); CPPUNIT_ASSERT(dest != NULL);
g_assert_cmpint(dest_size, ==, sizeof(src) * 2); CPPUNIT_ASSERT_EQUAL(sizeof(src) * 2, dest_size);
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i * 2], ==, src[i]); CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2]);
g_assert_cmpint(dest[i * 2 + 1], ==, src[i]); CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2 + 1]);
} }
} }
void void
test_pcm_channels_32() PcmChannelsTest::TestChannels32()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int32_t, N * 2>(); const auto src = TestDataBuffer<int32_t, N * 2>();
@ -71,20 +69,20 @@ test_pcm_channels_32()
const int32_t *dest = const int32_t *dest =
pcm_convert_channels_32(buffer, 1, 2, src, sizeof(src), pcm_convert_channels_32(buffer, 1, 2, src, sizeof(src),
&dest_size); &dest_size);
g_assert(dest != NULL); CPPUNIT_ASSERT(dest != NULL);
g_assert_cmpint(dest_size, ==, sizeof(src) / 2); CPPUNIT_ASSERT_EQUAL(sizeof(src) / 2, dest_size);
for (unsigned i = 0; i < N; ++i) for (unsigned i = 0; i < N; ++i)
g_assert_cmpint(dest[i], ==, CPPUNIT_ASSERT_EQUAL(int32_t(((int64_t)src[i * 2] + (int64_t)src[i * 2 + 1]) / 2),
((int64_t)src[i * 2] + (int64_t)src[i * 2 + 1]) / 2); dest[i]);
/* mono to stereo */ /* mono to stereo */
dest = pcm_convert_channels_32(buffer, 2, 1, src, sizeof(src), dest = pcm_convert_channels_32(buffer, 2, 1, src, sizeof(src),
&dest_size); &dest_size);
g_assert(dest != NULL); CPPUNIT_ASSERT(dest != NULL);
g_assert_cmpint(dest_size, ==, sizeof(src) * 2); CPPUNIT_ASSERT_EQUAL(sizeof(src) * 2, dest_size);
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i * 2], ==, src[i]); CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2]);
g_assert_cmpint(dest[i * 2 + 1], ==, src[i]); CPPUNIT_ASSERT_EQUAL(src[i], dest[i * 2 + 1]);
} }
} }

View File

@ -21,10 +21,8 @@
#include "test_pcm_util.hxx" #include "test_pcm_util.hxx"
#include "pcm/PcmDither.hxx" #include "pcm/PcmDither.hxx"
#include <glib.h>
void void
test_pcm_dither_24() PcmDitherTest::TestDither24()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int32_t, N>(GlibRandomInt24()); const auto src = TestDataBuffer<int32_t, N>(GlibRandomInt24());
@ -34,13 +32,13 @@ test_pcm_dither_24()
dither.Dither24To16(dest, src.begin(), src.end()); dither.Dither24To16(dest, src.begin(), src.end());
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i], >=, (src[i] >> 8) - 8); CPPUNIT_ASSERT(dest[i] >= (src[i] >> 8) - 8);
g_assert_cmpint(dest[i], <, (src[i] >> 8) + 8); CPPUNIT_ASSERT(dest[i] < (src[i] >> 8) + 8);
} }
} }
void void
test_pcm_dither_32() PcmDitherTest::TestDither32()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int32_t, N>(); const auto src = TestDataBuffer<int32_t, N>();
@ -50,7 +48,7 @@ test_pcm_dither_32()
dither.Dither32To16(dest, src.begin(), src.end()); dither.Dither32To16(dest, src.begin(), src.end());
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i], >=, (src[i] >> 16) - 8); CPPUNIT_ASSERT(dest[i] >= (src[i] >> 16) - 8);
g_assert_cmpint(dest[i], <, (src[i] >> 16) + 8); CPPUNIT_ASSERT(dest[i] < (src[i] >> 16) + 8);
} }
} }

View File

@ -26,10 +26,8 @@
#include "pcm/PcmBuffer.hxx" #include "pcm/PcmBuffer.hxx"
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include <glib.h>
void void
test_pcm_format_8_to_16() PcmFormatTest::TestFormat8to16()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int8_t, N>(); const auto src = TestDataBuffer<int8_t, N>();
@ -41,14 +39,14 @@ test_pcm_format_8_to_16()
auto d = pcm_convert_to_16(buffer, dither, SampleFormat::S8, auto d = pcm_convert_to_16(buffer, dither, SampleFormat::S8,
src, sizeof(src), &d_size); src, sizeof(src), &d_size);
auto d_end = pcm_end_pointer(d, d_size); auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N); CPPUNIT_ASSERT_EQUAL(N, unsigned(d_end - d));
for (size_t i = 0; i < N; ++i) for (size_t i = 0; i < N; ++i)
g_assert_cmpint(src[i], ==, d[i] >> 8); CPPUNIT_ASSERT_EQUAL(int(src[i]), d[i] >> 8);
} }
void void
test_pcm_format_16_to_24() PcmFormatTest::TestFormat16to24()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int16_t, N>(); const auto src = TestDataBuffer<int16_t, N>();
@ -59,14 +57,14 @@ test_pcm_format_16_to_24()
auto d = pcm_convert_to_24(buffer, SampleFormat::S16, auto d = pcm_convert_to_24(buffer, SampleFormat::S16,
src, sizeof(src), &d_size); src, sizeof(src), &d_size);
auto d_end = pcm_end_pointer(d, d_size); auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N); CPPUNIT_ASSERT_EQUAL(N, unsigned(d_end - d));
for (size_t i = 0; i < N; ++i) for (size_t i = 0; i < N; ++i)
g_assert_cmpint(src[i], ==, d[i] >> 8); CPPUNIT_ASSERT_EQUAL(int(src[i]), d[i] >> 8);
} }
void void
test_pcm_format_16_to_32() PcmFormatTest::TestFormat16to32()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int16_t, N>(); const auto src = TestDataBuffer<int16_t, N>();
@ -77,14 +75,14 @@ test_pcm_format_16_to_32()
auto d = pcm_convert_to_32(buffer, SampleFormat::S16, auto d = pcm_convert_to_32(buffer, SampleFormat::S16,
src, sizeof(src), &d_size); src, sizeof(src), &d_size);
auto d_end = pcm_end_pointer(d, d_size); auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N); CPPUNIT_ASSERT_EQUAL(N, unsigned(d_end - d));
for (size_t i = 0; i < N; ++i) for (size_t i = 0; i < N; ++i)
g_assert_cmpint(src[i], ==, d[i] >> 16); CPPUNIT_ASSERT_EQUAL(int(src[i]), d[i] >> 16);
} }
void void
test_pcm_format_float() PcmFormatTest::TestFormatFloat()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int16_t, N>(); const auto src = TestDataBuffer<int16_t, N>();
@ -95,11 +93,11 @@ test_pcm_format_float()
auto f = pcm_convert_to_float(buffer1, SampleFormat::S16, auto f = pcm_convert_to_float(buffer1, SampleFormat::S16,
src, sizeof(src), &f_size); src, sizeof(src), &f_size);
auto f_end = pcm_end_pointer(f, f_size); auto f_end = pcm_end_pointer(f, f_size);
g_assert_cmpint(f_end - f, ==, N); CPPUNIT_ASSERT_EQUAL(N, unsigned(f_end - f));
for (auto i = f; i != f_end; ++i) { for (auto i = f; i != f_end; ++i) {
g_assert(*i >= -1.); CPPUNIT_ASSERT(*i >= -1.);
g_assert(*i <= 1.); CPPUNIT_ASSERT(*i <= 1.);
} }
PcmDither dither; PcmDither dither;
@ -109,8 +107,8 @@ test_pcm_format_float()
SampleFormat::FLOAT, SampleFormat::FLOAT,
f, f_size, &d_size); f, f_size, &d_size);
auto d_end = pcm_end_pointer(d, d_size); auto d_end = pcm_end_pointer(d, d_size);
g_assert_cmpint(d_end - d, ==, N); CPPUNIT_ASSERT_EQUAL(N, unsigned(d_end - d));
for (size_t i = 0; i < N; ++i) for (size_t i = 0; i < N; ++i)
g_assert_cmpint(src[i], ==, d[i]); CPPUNIT_ASSERT_EQUAL(src[i], d[i]);
} }

View File

@ -18,35 +18,16 @@
*/ */
#include "test_pcm_all.hxx" #include "test_pcm_all.hxx"
#include "Compiler.h"
#include <glib.h> #include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
int int
main(int argc, char **argv) main(gcc_unused int argc, gcc_unused char **argv)
{ {
g_test_init (&argc, &argv, NULL); CppUnit::TextUi::TestRunner runner;
g_test_add_func("/pcm/dither/24", test_pcm_dither_24); auto &registry = CppUnit::TestFactoryRegistry::getRegistry();
g_test_add_func("/pcm/dither/32", test_pcm_dither_32); runner.addTest(registry.makeTest());
g_test_add_func("/pcm/pack/pack24", test_pcm_pack_24); return runner.run() ? EXIT_SUCCESS : EXIT_FAILURE;
g_test_add_func("/pcm/pack/unpack24", test_pcm_unpack_24);
g_test_add_func("/pcm/channels/16", test_pcm_channels_16);
g_test_add_func("/pcm/channels/32", test_pcm_channels_32);
g_test_add_func("/pcm/volume/8", test_pcm_volume_8);
g_test_add_func("/pcm/volume/16", test_pcm_volume_16);
g_test_add_func("/pcm/volume/24", test_pcm_volume_24);
g_test_add_func("/pcm/volume/32", test_pcm_volume_32);
g_test_add_func("/pcm/volume/float", test_pcm_volume_float);
g_test_add_func("/pcm/format/8_to_16", test_pcm_format_8_to_16);
g_test_add_func("/pcm/format/16_to_24", test_pcm_format_16_to_24);
g_test_add_func("/pcm/format/16_to_32", test_pcm_format_16_to_32);
g_test_add_func("/pcm/format/float", test_pcm_format_float);
g_test_add_func("/pcm/mix/8", test_pcm_mix_8);
g_test_add_func("/pcm/mix/16", test_pcm_mix_16);
g_test_add_func("/pcm/mix/24", test_pcm_mix_24);
g_test_add_func("/pcm/mix/32", test_pcm_mix_32);
g_test_run();
} }

View File

@ -22,10 +22,8 @@
#include "test_pcm_util.hxx" #include "test_pcm_util.hxx"
#include "pcm/PcmMix.hxx" #include "pcm/PcmMix.hxx"
#include <glib.h>
template<typename T, SampleFormat format, typename G=GlibRandomInt<T>> template<typename T, SampleFormat format, typename G=GlibRandomInt<T>>
void static void
TestPcmMix(G g=G()) TestPcmMix(G g=G())
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
@ -36,21 +34,21 @@ TestPcmMix(G g=G())
auto result = src1; auto result = src1;
bool success = pcm_mix(result.begin(), src2.begin(), sizeof(result), bool success = pcm_mix(result.begin(), src2.begin(), sizeof(result),
format, 1.0); format, 1.0);
g_assert(success); CPPUNIT_ASSERT(success);
AssertEqualWithTolerance(result, src1, 1); AssertEqualWithTolerance(result, src1, 1);
/* portion1=0.0: result must be equal to src2 */ /* portion1=0.0: result must be equal to src2 */
result = src1; result = src1;
success = pcm_mix(result.begin(), src2.begin(), sizeof(result), success = pcm_mix(result.begin(), src2.begin(), sizeof(result),
format, 0.0); format, 0.0);
g_assert(success); CPPUNIT_ASSERT(success);
AssertEqualWithTolerance(result, src2, 1); AssertEqualWithTolerance(result, src2, 1);
/* portion1=0.5 */ /* portion1=0.5 */
result = src1; result = src1;
success = pcm_mix(result.begin(), src2.begin(), sizeof(result), success = pcm_mix(result.begin(), src2.begin(), sizeof(result),
format, 0.5); format, 0.5);
g_assert(success); CPPUNIT_ASSERT(success);
auto expected = src1; auto expected = src1;
for (unsigned i = 0; i < N; ++i) for (unsigned i = 0; i < N; ++i)
@ -60,25 +58,25 @@ TestPcmMix(G g=G())
} }
void void
test_pcm_mix_8() PcmMixTest::TestMix8()
{ {
TestPcmMix<int8_t, SampleFormat::S8>(); TestPcmMix<int8_t, SampleFormat::S8>();
} }
void void
test_pcm_mix_16() PcmMixTest::TestMix16()
{ {
TestPcmMix<int16_t, SampleFormat::S16>(); TestPcmMix<int16_t, SampleFormat::S16>();
} }
void void
test_pcm_mix_24() PcmMixTest::TestMix24()
{ {
TestPcmMix<int32_t, SampleFormat::S24_P32>(GlibRandomInt24()); TestPcmMix<int32_t, SampleFormat::S24_P32>(GlibRandomInt24());
} }
void void
test_pcm_mix_32() PcmMixTest::TestMix32()
{ {
TestPcmMix<int32_t, SampleFormat::S32>(); TestPcmMix<int32_t, SampleFormat::S32>();
} }

View File

@ -25,7 +25,7 @@
#include <glib.h> #include <glib.h>
void void
test_pcm_pack_24() PcmPackTest::TestPack24()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<int32_t, N>(GlibRandomInt24()); const auto src = TestDataBuffer<int32_t, N>(GlibRandomInt24());
@ -44,12 +44,12 @@ test_pcm_pack_24()
if (d & 0x800000) if (d & 0x800000)
d |= 0xff000000; d |= 0xff000000;
g_assert_cmpint(d, ==, src[i]); CPPUNIT_ASSERT_EQUAL(d, src[i]);
} }
} }
void void
test_pcm_unpack_24() PcmPackTest::TestUnpack24()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
const auto src = TestDataBuffer<uint8_t, N * 3>(); const auto src = TestDataBuffer<uint8_t, N * 3>();
@ -68,6 +68,6 @@ test_pcm_unpack_24()
if (s & 0x800000) if (s & 0x800000)
s |= 0xff000000; s |= 0xff000000;
g_assert_cmpint(s, ==, dest[i]); CPPUNIT_ASSERT_EQUAL(s, dest[i]);
} }
} }

View File

@ -72,13 +72,13 @@ template<typename T>
bool bool
AssertEqualWithTolerance(const T &a, const T &b, unsigned tolerance) AssertEqualWithTolerance(const T &a, const T &b, unsigned tolerance)
{ {
g_assert_cmpint(a.size(), ==, b.size()); CPPUNIT_ASSERT_EQUAL(a.size(), b.size());
for (unsigned i = 0; i < a.size(); ++i) { for (unsigned i = 0; i < a.size(); ++i) {
int64_t x = a[i], y = b[i]; int64_t x = a[i], y = b[i];
g_assert_cmpint(x, >=, y - int64_t(tolerance)); CPPUNIT_ASSERT(x >= y - int64_t(tolerance));
g_assert_cmpint(x, <=, y + int64_t(tolerance)); CPPUNIT_ASSERT(x <= y + int64_t(tolerance));
} }
return true; return true;

View File

@ -21,14 +21,12 @@
#include "pcm/PcmVolume.hxx" #include "pcm/PcmVolume.hxx"
#include "test_pcm_util.hxx" #include "test_pcm_util.hxx"
#include <glib.h>
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h>
void void
test_pcm_volume_8() PcmVolumeTest::TestVolume8()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
static int8_t zero[N]; static int8_t zero[N];
@ -37,27 +35,30 @@ test_pcm_volume_8()
int8_t dest[N]; int8_t dest[N];
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S8, CPPUNIT_ASSERT_EQUAL(true,
0), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0); SampleFormat::S8, 0));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, zero, sizeof(zero)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S8, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0); SampleFormat::S8, PCM_VOLUME_1));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, src, sizeof(src)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S8, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1 / 2), ==, true); pcm_volume(dest, sizeof(dest),
SampleFormat::S8, PCM_VOLUME_1 / 2));
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i], >=, (src[i] - 1) / 2); CPPUNIT_ASSERT(dest[i] >= (src[i] - 1) / 2);
g_assert_cmpint(dest[i], <=, src[i] / 2 + 1); CPPUNIT_ASSERT(dest[i] <= src[i] / 2 + 1);
} }
} }
void void
test_pcm_volume_16() PcmVolumeTest::TestVolume16()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
static int16_t zero[N]; static int16_t zero[N];
@ -66,27 +67,30 @@ test_pcm_volume_16()
int16_t dest[N]; int16_t dest[N];
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S16, CPPUNIT_ASSERT_EQUAL(true,
0), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0); SampleFormat::S16, 0));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, zero, sizeof(zero)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S16, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0); SampleFormat::S16, PCM_VOLUME_1));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, src, sizeof(src)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S16, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1 / 2), ==, true); pcm_volume(dest, sizeof(dest),
SampleFormat::S16, PCM_VOLUME_1 / 2));
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i], >=, (src[i] - 1) / 2); CPPUNIT_ASSERT(dest[i] >= (src[i] - 1) / 2);
g_assert_cmpint(dest[i], <=, src[i] / 2 + 1); CPPUNIT_ASSERT(dest[i] <= src[i] / 2 + 1);
} }
} }
void void
test_pcm_volume_24() PcmVolumeTest::TestVolume24()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
static int32_t zero[N]; static int32_t zero[N];
@ -95,27 +99,30 @@ test_pcm_volume_24()
int32_t dest[N]; int32_t dest[N];
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S24_P32, CPPUNIT_ASSERT_EQUAL(true,
0), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0); SampleFormat::S24_P32, 0));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, zero, sizeof(zero)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S24_P32, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0); SampleFormat::S24_P32, PCM_VOLUME_1));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, src, sizeof(src)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S24_P32, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1 / 2), ==, true); pcm_volume(dest, sizeof(dest),
SampleFormat::S24_P32, PCM_VOLUME_1 / 2));
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i], >=, (src[i] - 1) / 2); CPPUNIT_ASSERT(dest[i] >= (src[i] - 1) / 2);
g_assert_cmpint(dest[i], <=, src[i] / 2 + 1); CPPUNIT_ASSERT(dest[i] <= src[i] / 2 + 1);
} }
} }
void void
test_pcm_volume_32() PcmVolumeTest::TestVolume32()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
static int32_t zero[N]; static int32_t zero[N];
@ -124,27 +131,30 @@ test_pcm_volume_32()
int32_t dest[N]; int32_t dest[N];
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S32, CPPUNIT_ASSERT_EQUAL(true,
0), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0); SampleFormat::S32, 0));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, zero, sizeof(zero)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S32, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0); SampleFormat::S32, PCM_VOLUME_1));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, src, sizeof(src)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::S32, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1 / 2), ==, true); pcm_volume(dest, sizeof(dest),
SampleFormat::S32, PCM_VOLUME_1 / 2));
for (unsigned i = 0; i < N; ++i) { for (unsigned i = 0; i < N; ++i) {
g_assert_cmpint(dest[i], >=, (src[i] - 1) / 2); CPPUNIT_ASSERT(dest[i] >= (src[i] - 1) / 2);
g_assert_cmpint(dest[i], <=, src[i] / 2 + 1); CPPUNIT_ASSERT(dest[i] <= src[i] / 2 + 1);
} }
} }
void void
test_pcm_volume_float() PcmVolumeTest::TestVolumeFloat()
{ {
constexpr unsigned N = 256; constexpr unsigned N = 256;
static float zero[N]; static float zero[N];
@ -153,19 +163,23 @@ test_pcm_volume_float()
float dest[N]; float dest[N];
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::FLOAT, CPPUNIT_ASSERT_EQUAL(true,
0), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, zero, sizeof(zero)), ==, 0); SampleFormat::FLOAT, 0));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, zero, sizeof(zero)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::FLOAT, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1), ==, true); pcm_volume(dest, sizeof(dest),
g_assert_cmpint(memcmp(dest, src, sizeof(src)), ==, 0); SampleFormat::FLOAT, PCM_VOLUME_1));
CPPUNIT_ASSERT_EQUAL(0, memcmp(dest, src, sizeof(src)));
std::copy(src.begin(), src.end(), dest); std::copy(src.begin(), src.end(), dest);
g_assert_cmpint(pcm_volume(dest, sizeof(dest), SampleFormat::FLOAT, CPPUNIT_ASSERT_EQUAL(true,
PCM_VOLUME_1 / 2), ==, true); pcm_volume(dest, sizeof(dest),
SampleFormat::FLOAT,
PCM_VOLUME_1 / 2));
for (unsigned i = 0; i < N; ++i) for (unsigned i = 0; i < N; ++i)
g_assert_cmpfloat(dest[i], ==, src[i] / 2); CPPUNIT_ASSERT_DOUBLES_EQUAL(src[i] / 2, dest[i], 1);
} }

View File

@ -4,7 +4,10 @@
#include "Directory.hxx" #include "Directory.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include <glib.h> #include <cppunit/TestFixture.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
Directory detached_root; Directory detached_root;
@ -22,16 +25,6 @@ Song::Free()
{ {
} }
gcc_unused
static void
dump_order(const struct queue *queue)
{
g_printerr("queue length=%u, order:\n", queue->GetLength());
for (unsigned i = 0; i < queue->GetLength(); ++i)
g_printerr(" [%u] -> %u (prio=%u)\n", i, queue->order[i],
queue->items[queue->order[i]].priority);
}
static void static void
check_descending_priority(const struct queue *queue, check_descending_priority(const struct queue *queue,
unsigned start_order) unsigned start_order)
@ -48,8 +41,17 @@ check_descending_priority(const struct queue *queue,
} }
} }
int class QueuePriorityTest : public CppUnit::TestFixture {
main(gcc_unused int argc, gcc_unused char **argv) CPPUNIT_TEST_SUITE(QueuePriorityTest);
CPPUNIT_TEST(TestPriority);
CPPUNIT_TEST_SUITE_END();
public:
void TestPriority();
};
void
QueuePriorityTest::TestPriority()
{ {
static Song songs[16]; static Song songs[16];
@ -58,7 +60,7 @@ main(gcc_unused int argc, gcc_unused char **argv)
for (unsigned i = 0; i < ARRAY_SIZE(songs); ++i) for (unsigned i = 0; i < ARRAY_SIZE(songs); ++i)
queue.Append(&songs[i], 0); queue.Append(&songs[i], 0);
assert(queue.GetLength() == ARRAY_SIZE(songs)); CPPUNIT_ASSERT_EQUAL(unsigned(ARRAY_SIZE(songs)), queue.GetLength());
/* priority=10 for 4 items */ /* priority=10 for 4 items */
@ -85,7 +87,7 @@ main(gcc_unused int argc, gcc_unused char **argv)
queue.SetPriorityRange(15, 16, 50, -1); queue.SetPriorityRange(15, 16, 50, -1);
check_descending_priority(&queue, 0); check_descending_priority(&queue, 0);
assert(queue.PositionToOrder(15) == 0); CPPUNIT_ASSERT_EQUAL(0u, queue.PositionToOrder(15));
for (unsigned i = 0; i < 4; ++i) { for (unsigned i = 0; i < 4; ++i) {
assert(queue.PositionToOrder(i) >= 4); assert(queue.PositionToOrder(i) >= 4);
@ -105,8 +107,8 @@ main(gcc_unused int argc, gcc_unused char **argv)
queue.SetPriorityRange(3, 4, 20, -1); queue.SetPriorityRange(3, 4, 20, -1);
check_descending_priority(&queue, 0); check_descending_priority(&queue, 0);
assert(queue.PositionToOrder(3) == 1); CPPUNIT_ASSERT_EQUAL(1u, queue.PositionToOrder(3));
assert(queue.PositionToOrder(15) == 0); CPPUNIT_ASSERT_EQUAL(0u, queue.PositionToOrder(15));
for (unsigned i = 0; i < 3; ++i) { for (unsigned i = 0; i < 3; ++i) {
assert(queue.PositionToOrder(i) >= 5); assert(queue.PositionToOrder(i) >= 5);
@ -131,14 +133,14 @@ main(gcc_unused int argc, gcc_unused char **argv)
unsigned a_order = 3; unsigned a_order = 3;
unsigned a_position = queue.OrderToPosition(a_order); unsigned a_position = queue.OrderToPosition(a_order);
assert(queue.items[a_position].priority == 10); CPPUNIT_ASSERT_EQUAL(10u, unsigned(queue.items[a_position].priority));
queue.SetPriority(a_position, 20, current_order); queue.SetPriority(a_position, 20, current_order);
current_order = queue.PositionToOrder(current_position); current_order = queue.PositionToOrder(current_position);
assert(current_order == 3); CPPUNIT_ASSERT_EQUAL(3u, current_order);
a_order = queue.PositionToOrder(a_position); a_order = queue.PositionToOrder(a_position);
assert(a_order == 4); CPPUNIT_ASSERT_EQUAL(4u, a_order);
check_descending_priority(&queue, current_order + 1); check_descending_priority(&queue, current_order + 1);
@ -148,14 +150,14 @@ main(gcc_unused int argc, gcc_unused char **argv)
unsigned b_order = 10; unsigned b_order = 10;
unsigned b_position = queue.OrderToPosition(b_order); unsigned b_position = queue.OrderToPosition(b_order);
assert(queue.items[b_position].priority == 0); CPPUNIT_ASSERT_EQUAL(0u, unsigned(queue.items[b_position].priority));
queue.SetPriority(b_position, 70, current_order); queue.SetPriority(b_position, 70, current_order);
current_order = queue.PositionToOrder(current_position); current_order = queue.PositionToOrder(current_position);
assert(current_order == 3); CPPUNIT_ASSERT_EQUAL(3u, current_order);
b_order = queue.PositionToOrder(b_position); b_order = queue.PositionToOrder(b_position);
assert(b_order == 4); CPPUNIT_ASSERT_EQUAL(4u, b_order);
check_descending_priority(&queue, current_order + 1); check_descending_priority(&queue, current_order + 1);
@ -165,25 +167,36 @@ main(gcc_unused int argc, gcc_unused char **argv)
unsigned c_order = 0; unsigned c_order = 0;
unsigned c_position = queue.OrderToPosition(c_order); unsigned c_position = queue.OrderToPosition(c_order);
assert(queue.items[c_position].priority == 50); CPPUNIT_ASSERT_EQUAL(50u, unsigned(queue.items[c_position].priority));
queue.SetPriority(c_position, 60, current_order); queue.SetPriority(c_position, 60, current_order);
current_order = queue.PositionToOrder(current_position); current_order = queue.PositionToOrder(current_position);
assert(current_order == 3); CPPUNIT_ASSERT_EQUAL(3u, current_order);
c_order = queue.PositionToOrder(c_position); c_order = queue.PositionToOrder(c_position);
assert(c_order == 0); CPPUNIT_ASSERT_EQUAL(0u, c_order);
/* move the prio=20 item back */ /* move the prio=20 item back */
a_order = queue.PositionToOrder(a_position); a_order = queue.PositionToOrder(a_position);
assert(a_order == 5); CPPUNIT_ASSERT_EQUAL(5u, a_order);
assert(queue.items[a_position].priority == 20); CPPUNIT_ASSERT_EQUAL(20u, unsigned(queue.items[a_position].priority));
queue.SetPriority(a_position, 5, current_order); queue.SetPriority(a_position, 5, current_order);
current_order = queue.PositionToOrder(current_position); current_order = queue.PositionToOrder(current_position);
assert(current_order == 3); CPPUNIT_ASSERT_EQUAL(3u, current_order);
a_order = queue.PositionToOrder(a_position); a_order = queue.PositionToOrder(a_position);
assert(a_order == 6); CPPUNIT_ASSERT_EQUAL(6u, a_order);
}
CPPUNIT_TEST_SUITE_REGISTRATION(QueuePriorityTest);
int
main(gcc_unused int argc, gcc_unused char **argv)
{
CppUnit::TextUi::TestRunner runner;
auto &registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
return runner.run() ? EXIT_SUCCESS : EXIT_FAILURE;
} }