diff options
author | Max Kellermann <max@musicpd.org> | 2018-10-16 19:01:13 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-10-16 21:26:04 +0200 |
commit | 01b6e1cbf28f54793e22cc40affac7fb03511180 (patch) | |
tree | 5ac27527b2c5f36384f2c42d3907f12fa96067af /test/test_pcm_mix.cxx | |
parent | eefc0f5d80fbcb485db230c3df090b69994a75ce (diff) |
test: use GTest instead of cppunit
Diffstat (limited to 'test/test_pcm_mix.cxx')
-rw-r--r-- | test/test_pcm_mix.cxx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/test/test_pcm_mix.cxx b/test/test_pcm_mix.cxx index 2f8f94e2e..d08a730b9 100644 --- a/test/test_pcm_mix.cxx +++ b/test/test_pcm_mix.cxx @@ -18,11 +18,12 @@ */ #include "config.h" -#include "test_pcm_all.hxx" #include "test_pcm_util.hxx" #include "pcm/PcmMix.hxx" #include "pcm/PcmDither.hxx" +#include <gtest/gtest.h> + template<typename T, SampleFormat format, typename G=RandomInt<T>> static void TestPcmMix(G g=G()) @@ -38,49 +39,46 @@ TestPcmMix(G g=G()) bool success = pcm_mix(dither, result.begin(), src2.begin(), sizeof(result), format, 1.0); - CPPUNIT_ASSERT(success); + ASSERT_TRUE(success); AssertEqualWithTolerance(result, src1, 3); /* portion1=0.0: result must be equal to src2 */ result = src1; success = pcm_mix(dither, result.begin(), src2.begin(), sizeof(result), format, 0.0); - CPPUNIT_ASSERT(success); + ASSERT_TRUE(success); AssertEqualWithTolerance(result, src2, 3); /* portion1=0.5 */ result = src1; success = pcm_mix(dither, result.begin(), src2.begin(), sizeof(result), format, 0.5); - CPPUNIT_ASSERT(success); + ASSERT_TRUE(success); auto expected = src1; for (unsigned i = 0; i < N; ++i) expected[i] = (int64_t(src1[i]) + int64_t(src2[i])) / 2; - AssertEqualWithTolerance(result, expected, 3); + for (unsigned i = 0; i < N; ++i) + EXPECT_NEAR(result[i], expected[i], 3); } -void -PcmMixTest::TestMix8() +TEST(PcmTest, Mix8) { TestPcmMix<int8_t, SampleFormat::S8>(); } -void -PcmMixTest::TestMix16() +TEST(PcmTest, Mix16) { TestPcmMix<int16_t, SampleFormat::S16>(); } -void -PcmMixTest::TestMix24() +TEST(PcmTest, Mix24) { TestPcmMix<int32_t, SampleFormat::S24_P32>(RandomInt24()); } -void -PcmMixTest::TestMix32() +TEST(PcmTest, Mix32) { TestPcmMix<int32_t, SampleFormat::S32>(); } |