From 401a799a1b5de5d70a6b4c1d49235af0d5618f37 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 16 Oct 2013 21:55:00 +0200 Subject: test: use the CPPUNIT framework for unit tests --- test/test_pcm_all.hxx | 150 +++++++++++++++++++++++++++++++------------------- 1 file changed, 94 insertions(+), 56 deletions(-) (limited to 'test/test_pcm_all.hxx') diff --git a/test/test_pcm_all.hxx b/test/test_pcm_all.hxx index 18202454b..2a0aa8628 100644 --- a/test/test_pcm_all.hxx +++ b/test/test_pcm_all.hxx @@ -20,61 +20,99 @@ #ifndef MPD_TEST_PCM_ALL_HXX #define MPD_TEST_PCM_ALL_HXX -void -test_pcm_dither_24(); - -void -test_pcm_dither_32(); - -void -test_pcm_pack_24(); - -void -test_pcm_unpack_24(); - -void -test_pcm_channels_16(); - -void -test_pcm_channels_32(); - -void -test_pcm_volume_8(); - -void -test_pcm_volume_16(); - -void -test_pcm_volume_24(); - -void -test_pcm_volume_32(); - -void -test_pcm_volume_float(); - -void -test_pcm_format_8_to_16(); - -void -test_pcm_format_16_to_24(); - -void -test_pcm_format_16_to_32(); - -void -test_pcm_format_float(); - -void -test_pcm_mix_8(); - -void -test_pcm_mix_16(); - -void -test_pcm_mix_24(); - -void -test_pcm_mix_32(); +#include +#include + +class PcmDitherTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(PcmDitherTest); + CPPUNIT_TEST(TestDither24); + CPPUNIT_TEST(TestDither32); + CPPUNIT_TEST_SUITE_END(); + +public: + void TestDither24(); + void TestDither32(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PcmDitherTest); + +class PcmPackTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(PcmPackTest); + CPPUNIT_TEST(TestPack24); + CPPUNIT_TEST(TestUnpack24); + CPPUNIT_TEST_SUITE_END(); + +public: + void TestPack24(); + void TestUnpack24(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PcmPackTest); + +class PcmChannelsTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(PcmChannelsTest); + CPPUNIT_TEST(TestChannels16); + CPPUNIT_TEST(TestChannels32); + CPPUNIT_TEST_SUITE_END(); + +public: + void TestChannels16(); + void TestChannels32(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PcmChannelsTest); + +class PcmVolumeTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(PcmVolumeTest); + CPPUNIT_TEST(TestVolume8); + CPPUNIT_TEST(TestVolume16); + CPPUNIT_TEST(TestVolume24); + CPPUNIT_TEST(TestVolume32); + CPPUNIT_TEST(TestVolumeFloat); + CPPUNIT_TEST_SUITE_END(); + +public: + void TestVolume8(); + void TestVolume16(); + void TestVolume24(); + void TestVolume32(); + void TestVolumeFloat(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PcmVolumeTest); + +class PcmFormatTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(PcmFormatTest); + CPPUNIT_TEST(TestFormat8to16); + CPPUNIT_TEST(TestFormat16to24); + CPPUNIT_TEST(TestFormat16to32); + CPPUNIT_TEST(TestFormatFloat); + CPPUNIT_TEST_SUITE_END(); + +public: + void TestFormat8to16(); + void TestFormat16to24(); + void TestFormat16to32(); + void TestFormatFloat(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PcmFormatTest); + +class PcmMixTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(PcmMixTest); + CPPUNIT_TEST(TestMix8); + CPPUNIT_TEST(TestMix16); + CPPUNIT_TEST(TestMix24); + CPPUNIT_TEST(TestMix32); + CPPUNIT_TEST_SUITE_END(); + +public: + void TestMix8(); + void TestMix16(); + void TestMix24(); + void TestMix32(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(PcmMixTest); #endif -- cgit v1.2.3