summaryrefslogtreecommitdiff
path: root/test/test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-09-06 20:10:13 +0200
committerCarl Hetherington <cth@carlh.net>2020-09-20 19:34:50 +0200
commit27eb42c125ce1f5a9bbcb3b48b50921e4ec4985a (patch)
treef9dbeb0e3cad4594b74942c2068903efb5ae3788 /test/test.cc
parentc6a700e8de9ea51122870765aecee81870f35b1b (diff)
Support MCA sound channel tags in MXF/CPL.
Diffstat (limited to 'test/test.cc')
-rw-r--r--test/test.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/test.cc b/test/test.cc
index dd143264..62013687 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -95,12 +95,12 @@ struct TestConfig
};
void
-check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore)
+check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore_tags, bool ignore_whitespace)
{
BOOST_CHECK_EQUAL (ref->get_name (), test->get_name ());
BOOST_CHECK_EQUAL (ref->get_namespace_prefix (), test->get_namespace_prefix ());
- if (find (ignore.begin(), ignore.end(), ref->get_name()) != ignore.end ()) {
+ if (find(ignore_tags.begin(), ignore_tags.end(), ref->get_name()) != ignore_tags.end()) {
return;
}
@@ -121,14 +121,20 @@ check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore)
xmlpp::Element* test_el = dynamic_cast<xmlpp::Element*> (*l);
BOOST_CHECK ((ref_el && test_el) || (!ref_el && !test_el));
if (ref_el && test_el) {
- check_xml (ref_el, test_el, ignore);
+ check_xml (ref_el, test_el, ignore_tags, ignore_whitespace);
}
xmlpp::ContentNode* ref_cn = dynamic_cast<xmlpp::ContentNode*> (*k);
xmlpp::ContentNode* test_cn = dynamic_cast<xmlpp::ContentNode*> (*l);
BOOST_CHECK ((ref_cn && test_cn) || (!ref_cn && !test_cn));
if (ref_cn && test_cn) {
- BOOST_CHECK_EQUAL (ref_cn->get_content(), test_cn->get_content ());
+ if (
+ !ignore_whitespace ||
+ ref_cn->get_content().find_first_not_of(" \t\r\n") != string::npos ||
+ test_cn->get_content().find_first_not_of(" \t\r\n") != string::npos) {
+
+ BOOST_CHECK_EQUAL (ref_cn->get_content(), test_cn->get_content ());
+ }
}
++k;