tests: Create cpp file for helper

This commit is contained in:
Martchus 2017-05-24 19:33:11 +02:00
parent ae6bd9522c
commit 32f4c7641c
3 changed files with 25 additions and 22 deletions

View File

@ -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

22
tests/helper.cpp Normal file
View File

@ -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;
}

View File

@ -5,34 +5,14 @@
#include <ostream>
/*!
* \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