test: use GTest instead of cppunit

This commit is contained in:
Max Kellermann
2018-10-16 19:01:13 +02:00
parent eefc0f5d80
commit 01b6e1cbf2
39 changed files with 1027 additions and 1644 deletions

View File

@@ -18,12 +18,12 @@
*/
#include "config.h"
#include "test_pcm_all.hxx"
#include "test_pcm_util.hxx"
#include "pcm/PcmDither.cxx"
void
PcmDitherTest::TestDither24()
#include <gtest/gtest.h>
TEST(PcmTest, Dither24)
{
constexpr unsigned N = 509;
const auto src = TestDataBuffer<int32_t, N>(RandomInt24());
@@ -33,13 +33,12 @@ PcmDitherTest::TestDither24()
dither.Dither24To16(dest, src.begin(), src.end());
for (unsigned i = 0; i < N; ++i) {
CPPUNIT_ASSERT(dest[i] >= (src[i] >> 8) - 8);
CPPUNIT_ASSERT(dest[i] < (src[i] >> 8) + 8);
EXPECT_GE(dest[i], (src[i] >> 8) - 8);
EXPECT_LT(dest[i], (src[i] >> 8) + 8);
}
}
void
PcmDitherTest::TestDither32()
TEST(PcmTest, Dither32)
{
constexpr unsigned N = 509;
const auto src = TestDataBuffer<int32_t, N>();
@@ -49,7 +48,7 @@ PcmDitherTest::TestDither32()
dither.Dither32To16(dest, src.begin(), src.end());
for (unsigned i = 0; i < N; ++i) {
CPPUNIT_ASSERT(dest[i] >= (src[i] >> 16) - 8);
CPPUNIT_ASSERT(dest[i] < (src[i] >> 16) + 8);
EXPECT_GE(dest[i], (src[i] >> 16) - 8);
EXPECT_LT(dest[i], (src[i] >> 16) + 8);
}
}