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/TestAudioFormat.cxx | |
parent | eefc0f5d80fbcb485db230c3df090b69994a75ce (diff) |
test: use GTest instead of cppunit
Diffstat (limited to 'test/TestAudioFormat.cxx')
-rw-r--r-- | test/TestAudioFormat.cxx | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/test/TestAudioFormat.cxx b/test/TestAudioFormat.cxx index e5a5041b9..47d1edad8 100644 --- a/test/TestAudioFormat.cxx +++ b/test/TestAudioFormat.cxx @@ -18,45 +18,14 @@ */ #include "config.h" -#include "TestAudioFormat.hxx" #include "AudioFormat.hxx" #include "AudioParser.hxx" #include "util/StringBuffer.hxx" -#include <cppunit/TestAssert.h> +#include <gtest/gtest.h> #include <string.h> -namespace CppUnit { -template<> -struct assertion_traits<const char *> -{ - static bool equal(const char *x, const char *y) - { - return strcmp(x, y) == 0; - } - - static std::string toString(const char *x) - { - return std::string("\"") + x + "\""; - } -}; - -template<> -struct assertion_traits<AudioFormat> -{ - static bool equal(AudioFormat x, AudioFormat y) - { - return x == y; - } - - static std::string toString(AudioFormat x) - { - return ToString(x).c_str(); - } -}; -} - struct AudioFormatStringTest { AudioFormat af; const char *s; @@ -78,24 +47,19 @@ static constexpr AudioFormatStringTest af_mask_tests[] = { { AudioFormat::Undefined(), "*:*:*" }, }; -void -AudioFormatTest::TestToString() +TEST(AudioFormatTest, ToString) { for (const auto &i : af_string_tests) - CPPUNIT_ASSERT_EQUAL(i.s, ToString(i.af).c_str()); + EXPECT_STREQ(i.s, ToString(i.af).c_str()); } -void -AudioFormatTest::TestParse() +TEST(AudioFormatTest, Parse) { for (const auto &i : af_string_tests) { - CPPUNIT_ASSERT_EQUAL(i.af, - ParseAudioFormat(i.s, false)); - CPPUNIT_ASSERT_EQUAL(i.af, - ParseAudioFormat(i.s, true)); + EXPECT_EQ(i.af, ParseAudioFormat(i.s, false)); + EXPECT_EQ(i.af, ParseAudioFormat(i.s, true)); } for (const auto &i : af_mask_tests) - CPPUNIT_ASSERT_EQUAL(i.af, - ParseAudioFormat(i.s, true)); + EXPECT_EQ(i.af, ParseAudioFormat(i.s, true)); } |