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

@@ -19,6 +19,8 @@
#include "util/ConstBuffer.hxx"
#include <gtest/gtest.h>
#include <array>
#include <random>
@@ -92,13 +94,13 @@ template<typename T>
bool
AssertEqualWithTolerance(const T &a, const T &b, unsigned tolerance)
{
CPPUNIT_ASSERT_EQUAL(a.size(), b.size());
EXPECT_EQ(a.size(), b.size());
for (unsigned i = 0; i < a.size(); ++i) {
int64_t x = a[i], y = b[i];
CPPUNIT_ASSERT(x >= y - int64_t(tolerance));
CPPUNIT_ASSERT(x <= y + int64_t(tolerance));
EXPECT_GE(x, y - int64_t(tolerance));
EXPECT_LE(x, y + int64_t(tolerance));
}
return true;