tests: Create cpp file for helper
This commit is contained in:
parent
ae6bd9522c
commit
32f4c7641c
|
@ -146,6 +146,7 @@ set(TEST_HEADER_FILES
|
||||||
)
|
)
|
||||||
set(TEST_SRC_FILES
|
set(TEST_SRC_FILES
|
||||||
tests/cppunit.cpp
|
tests/cppunit.cpp
|
||||||
|
tests/helper.cpp
|
||||||
tests/testfilecheck.cpp
|
tests/testfilecheck.cpp
|
||||||
tests/overallgeneral.cpp
|
tests/overallgeneral.cpp
|
||||||
tests/overallmkv.cpp
|
tests/overallmkv.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;
|
||||||
|
}
|
|
@ -5,34 +5,14 @@
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
/*!
|
std::ostream &operator <<(std::ostream &os, const Media::TagTextEncoding &encoding);
|
||||||
* \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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Prints a TagValue UTF-8 encoded to enable CPPUNIT_ASSERT_EQUAL for tag values.
|
* \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)
|
inline std::ostream &operator <<(std::ostream &os, const Media::TagValue &tagValue)
|
||||||
{
|
{
|
||||||
os << tagValue.toString(Media::TagTextEncoding::Utf8) << " (encoding: " << tagValue.dataEncoding() << ")";
|
return os << tagValue.toString(Media::TagTextEncoding::Utf8) << " (encoding: " << tagValue.dataEncoding() << ")";
|
||||||
return os;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TAGPARSER_TEST_HELPER
|
#endif // TAGPARSER_TEST_HELPER
|
||||||
|
|
Loading…
Reference in New Issue