Skip to content

Commit 258059d

Browse files
committed
Add deepCopy() test for a non-trival document
Uses the kitchen sink xml that features all ADM elements to generate a document Then deep copies that document, and checks that xml written from both the document and its copy match (they may differ from the original)
1 parent 0469e4a commit 258059d

File tree

2 files changed

+581
-0
lines changed

2 files changed

+581
-0
lines changed

tests/adm_document_tests.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "adm/utilities/id_assignment.hpp"
55
#include "adm/utilities/copy.hpp"
66
#include "adm/utilities/object_creation.hpp"
7+
#include "adm/parse.hpp"
8+
#include "adm/write.hpp"
79

810
TEST_CASE("basic_document") {
911
using namespace adm;
@@ -629,3 +631,14 @@ TEST_CASE("remove_elements") {
629631
REQUIRE(trackUid->getReference<AudioTrackFormat>() == nullptr);
630632
}
631633
}
634+
635+
// Tests deepcopy using a modified version of the kitchen sink test material from https://qc.ebu.io/testmaterial
636+
TEST_CASE("Copy the kitchen sink") {
637+
auto document = parseXml("sink.xml");
638+
std::stringstream xml;
639+
writeXml(xml, document);
640+
auto documentCopy = document->deepCopy();
641+
std::stringstream xmlCopy;
642+
writeXml(xmlCopy, documentCopy);
643+
REQUIRE(xml.str() == xmlCopy.str());
644+
}

0 commit comments

Comments
 (0)