Skip to content

Commit

Permalink
Add deepCopy() test for a non-trival document
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
rsjbailey committed Apr 16, 2024
1 parent 0469e4a commit 258059d
Show file tree
Hide file tree
Showing 2 changed files with 581 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/adm_document_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "adm/utilities/id_assignment.hpp"
#include "adm/utilities/copy.hpp"
#include "adm/utilities/object_creation.hpp"
#include "adm/parse.hpp"
#include "adm/write.hpp"

TEST_CASE("basic_document") {
using namespace adm;
Expand Down Expand Up @@ -629,3 +631,14 @@ TEST_CASE("remove_elements") {
REQUIRE(trackUid->getReference<AudioTrackFormat>() == nullptr);
}
}

// Tests deepcopy using a modified version of the kitchen sink test material from https://qc.ebu.io/testmaterial
TEST_CASE("Copy the kitchen sink") {
auto document = parseXml("sink.xml");
std::stringstream xml;
writeXml(xml, document);
auto documentCopy = document->deepCopy();
std::stringstream xmlCopy;
writeXml(xmlCopy, documentCopy);
REQUIRE(xml.str() == xmlCopy.str());
}
Loading

0 comments on commit 258059d

Please sign in to comment.