From 32f4c7641c7e0a6cfd73a6bac8cbec099eff737f Mon Sep 17 00:00:00 2001 From: Martchus Date: Wed, 24 May 2017 19:33:11 +0200 Subject: [PATCH] tests: Create cpp file for helper --- CMakeLists.txt | 1 + tests/helper.cpp | 22 ++++++++++++++++++++++ tests/helper.h | 24 ++---------------------- 3 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 tests/helper.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7223986..85c21b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,7 @@ set(TEST_HEADER_FILES ) set(TEST_SRC_FILES tests/cppunit.cpp + tests/helper.cpp tests/testfilecheck.cpp tests/overallgeneral.cpp tests/overallmkv.cpp diff --git a/tests/helper.cpp b/tests/helper.cpp new file mode 100644 index 0000000..dfc259b --- /dev/null +++ b/tests/helper.cpp @@ -0,0 +1,22 @@ +#include "./helper.h" + +/*! + * \brief Prints a TagTextEncoding to enable CPPUNIT_ASSERT_EQUAL for tag values. + */ +std::ostream &operator <<(std::ostream &os, const Media::TagTextEncoding &encoding) +{ + using namespace Media; + switch(encoding) { + case TagTextEncoding::Unspecified: + return os << "unspecified"; + case TagTextEncoding::Latin1: + return os << "Latin-1"; + case TagTextEncoding::Utf8: + return os << "UTF-8"; + case TagTextEncoding::Utf16LittleEndian: + return os << "UTF-16 LE"; + case TagTextEncoding::Utf16BigEndian: + return os << "UTF-16 BE"; + } + return os; +} diff --git a/tests/helper.h b/tests/helper.h index 7eaae32..c924a54 100644 --- a/tests/helper.h +++ b/tests/helper.h @@ -5,34 +5,14 @@ #include -/*! - * \brief Prints a TagTextEncoding to enable CPPUNIT_ASSERT_EQUAL for tag values. - */ -inline std::ostream &operator <<(std::ostream &os, const Media::TagTextEncoding &encoding) -{ - using namespace Media; - switch(encoding) { - case TagTextEncoding::Unspecified: - return os << "unspecified"; - case TagTextEncoding::Latin1: - return os << "Latin-1"; - case TagTextEncoding::Utf8: - return os << "UTF-8"; - case TagTextEncoding::Utf16LittleEndian: - return os << "UTF-16 LE"; - case TagTextEncoding::Utf16BigEndian: - return os << "UTF-16 BE"; - } - return os; -} +std::ostream &operator <<(std::ostream &os, const Media::TagTextEncoding &encoding); /*! * \brief Prints a TagValue UTF-8 encoded to enable CPPUNIT_ASSERT_EQUAL for tag values. */ inline std::ostream &operator <<(std::ostream &os, const Media::TagValue &tagValue) { - os << tagValue.toString(Media::TagTextEncoding::Utf8) << " (encoding: " << tagValue.dataEncoding() << ")"; - return os; + return os << tagValue.toString(Media::TagTextEncoding::Utf8) << " (encoding: " << tagValue.dataEncoding() << ")"; } #endif // TAGPARSER_TEST_HELPER