summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-11 00:16:40 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:23 +0100
commitd95eacd3851a20e52202465ec22b4f72a4983dc8 (patch)
tree1dfc1092ae7d2e6b6b7c313ad808415f578d9712 /test
parentcbee0d077e698541afcea82a95bafcea5245ab89 (diff)
Replace std::list with std::vector in the API.
Diffstat (limited to 'test')
-rw-r--r--test/combine_test.cc26
-rw-r--r--test/cpl_metadata_test.cc12
-rw-r--r--test/cpl_ratings_test.cc2
-rw-r--r--test/mca_test.cc4
-rw-r--r--test/read_dcp_test.cc4
-rw-r--r--test/read_interop_subtitle_test.cc6
-rw-r--r--test/read_smpte_subtitle_test.cc4
-rw-r--r--test/rewrite_subs.cc12
-rw-r--r--test/round_trip_test.cc8
-rw-r--r--test/test.cc5
-rw-r--r--test/test.h4
-rw-r--r--test/util_test.cc4
-rw-r--r--test/verify_test.cc4
-rw-r--r--test/write_subtitle_test.cc18
14 files changed, 52 insertions, 61 deletions
diff --git a/test/combine_test.cc b/test/combine_test.cc
index c62f0322..89d2f094 100644
--- a/test/combine_test.cc
+++ b/test/combine_test.cc
@@ -70,7 +70,7 @@ progress (float)
static
void
-dump_notes (list<dcp::VerificationNote> const & notes)
+dump_notes (vector<dcp::VerificationNote> const & notes)
{
BOOST_FOREACH (dcp::VerificationNote i, notes) {
std::cout << dcp::note_to_string(i) << "\n";
@@ -84,23 +84,19 @@ check_no_errors (boost::filesystem::path path)
{
vector<boost::filesystem::path> directories;
directories.push_back (path);
- list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test);
- for (list<dcp::VerificationNote>::iterator i = notes.begin(); i != notes.end(); ) {
- list<dcp::VerificationNote>::iterator tmp = i;
- ++tmp;
- if (i->code() == dcp::VerificationNote::NOT_SMPTE) {
- notes.erase (i);
- }
- i = tmp;
- }
- dump_notes (notes);
- BOOST_CHECK (notes.empty());
+ auto notes = dcp::verify (directories, &stage, &progress, xsd_test);
+ vector<dcp::VerificationNote> filtered_notes;
+ std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered_notes), [](dcp::VerificationNote const& i) {
+ return i.code() != dcp::VerificationNote::NOT_SMPTE;
+ });
+ dump_notes (filtered_notes);
+ BOOST_CHECK (filtered_notes.empty());
}
template <class T>
shared_ptr<T>
-pointer_to_id_in_list (shared_ptr<T> needle, list<shared_ptr<T> > haystack)
+pointer_to_id_in_vector (shared_ptr<T> needle, vector<shared_ptr<T> > haystack)
{
BOOST_FOREACH (shared_ptr<T> i, haystack) {
if (i->id() == needle->id()) {
@@ -138,11 +134,11 @@ check_combined (vector<boost::filesystem::path> inputs, boost::filesystem::path
BOOST_REQUIRE (input_dcp.cpls().size() == 1);
shared_ptr<dcp::CPL> input_cpl = input_dcp.cpls().front();
- shared_ptr<dcp::CPL> output_cpl = pointer_to_id_in_list (input_cpl, output_dcp.cpls());
+ shared_ptr<dcp::CPL> output_cpl = pointer_to_id_in_vector (input_cpl, output_dcp.cpls());
BOOST_REQUIRE (output_cpl);
BOOST_FOREACH (shared_ptr<dcp::Asset> i, input_dcp.assets(true)) {
- shared_ptr<dcp::Asset> o = pointer_to_id_in_list(i, output_dcp.assets());
+ shared_ptr<dcp::Asset> o = pointer_to_id_in_vector(i, output_dcp.assets());
BOOST_REQUIRE_MESSAGE (o, "Could not find " << i->id() << " in combined DCP.");
BOOST_CHECK (i->equals(o, options, note_handler));
}
diff --git a/test/cpl_metadata_test.cc b/test/cpl_metadata_test.cc
index 19b0ef8e..a6dcd834 100644
--- a/test/cpl_metadata_test.cc
+++ b/test/cpl_metadata_test.cc
@@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_read_test1)
BOOST_CHECK (cpl.main_picture_stored_area().get() == dcp::Size(1998, 1080));
BOOST_CHECK (cpl.main_picture_active_area().get() == dcp::Size(1440, 1080));
- list<shared_ptr<dcp::Reel> > reels = cpl.reels ();
+ auto reels = cpl.reels ();
BOOST_REQUIRE_EQUAL (reels.size(), 1);
BOOST_REQUIRE (reels.front()->main_subtitle()->language());
BOOST_CHECK_EQUAL (reels.front()->main_subtitle()->language().get(), "de-DE");
@@ -312,7 +312,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test1)
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test1.xml"),
dcp::file_to_string("build/test/cpl_metadata_write_test1.xml"),
- list<string>()
+ vector<string>()
);
}
@@ -322,7 +322,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_1)
{
dcp::CPL cpl ("test/ref/cpl_metadata_test1.xml");
cpl.write_xml ("build/test/cpl_metadata_roundtrip_test1.xml", dcp::SMPTE, shared_ptr<dcp::CertificateChain>());
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("Id");
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test1.xml"),
@@ -363,7 +363,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test2)
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test2.xml"),
dcp::file_to_string("build/test/cpl_metadata_write_test2.xml"),
- list<string>()
+ vector<string>()
);
}
@@ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_read_test2)
BOOST_CHECK (cpl.main_picture_stored_area().get() == dcp::Size(1998, 1080));
BOOST_CHECK (cpl.main_picture_active_area().get() == dcp::Size(1440, 1080));
- list<shared_ptr<dcp::Reel> > reels = cpl.reels ();
+ auto reels = cpl.reels ();
BOOST_REQUIRE_EQUAL (reels.size(), 1);
}
@@ -413,7 +413,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_2)
{
dcp::CPL cpl ("test/ref/cpl_metadata_test2.xml");
cpl.write_xml ("build/test/cpl_metadata_roundtrip_test2.xml", dcp::SMPTE, shared_ptr<dcp::CertificateChain>());
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("Id");
check_xml (
dcp::file_to_string("test/ref/cpl_metadata_test2.xml"),
diff --git a/test/cpl_ratings_test.cc b/test/cpl_ratings_test.cc
index 1cb6394e..b5bfd389 100644
--- a/test/cpl_ratings_test.cc
+++ b/test/cpl_ratings_test.cc
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE (cpl_ratings)
cpl.write_xml ("build/test/cpl_ratings.xml", dcp::SMPTE, std::shared_ptr<dcp::CertificateChain>());
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("Id");
ignore.push_back ("Issuer");
ignore.push_back ("Creator");
diff --git a/test/mca_test.cc b/test/mca_test.cc
index b573daf1..faff3439 100644
--- a/test/mca_test.cc
+++ b/test/mca_test.cc
@@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE (parse_mca_descriptors_from_mxf_test)
cxml::Document ref("CompositionPlaylist", private_test / dcp::String::compose("51_sound_with_mca_%1.cpl", i));
cxml::Document check("CompositionPlaylist", dcp::String::compose("build/test/parse_mca_descriptors_from_mxf_test%1/cpl.xml", i));
- list<string> ignore;
+ vector<string> ignore;
check_xml (
dynamic_cast<xmlpp::Element*>(
ref.node_child("ReelList")->node_children("Reel").front()->node_child("AssetList")->node_child("CompositionMetadataAsset")->node_child("MCASubDescriptors")->node()
@@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE (write_mca_descriptors_to_mxf_test)
cxml::Document ref("CompositionPlaylist", private_test / "51_sound_with_mca_1.cpl");
cxml::Document check("CompositionPlaylist", "build/test/write_mca_descriptors_to_mxf_test/cpl.xml");
- list<string> ignore;
+ vector<string> ignore;
ignore.push_back ("InstanceID");
ignore.push_back ("MCALinkID");
ignore.push_back ("SoundfieldGroupLinkID");
diff --git a/test/read_dcp_test.cc b/test/read_dcp_test.cc
index c885523a..7eed18d0 100644
--- a/test/read_dcp_test.cc
+++ b/test/read_dcp_test.cc
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE (read_dcp_test1)
dcp::DCP d ("test/ref/DCP/dcp_test1");
d.read ();
- list<shared_ptr<dcp::CPL> > cpls = d.cpls ();
+ auto cpls = d.cpls ();
BOOST_CHECK_EQUAL (cpls.size(), 1);
BOOST_CHECK_EQUAL (cpls.front()->annotation_text(), "A Test DCP");
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE (read_dcp_test2)
dcp::DCP d ("test/ref/DCP/dcp_test3");
d.read ();
- list<shared_ptr<dcp::CPL> > cpls = d.cpls ();
+ auto cpls = d.cpls ();
BOOST_CHECK_EQUAL (cpls.size(), 1);
BOOST_CHECK_EQUAL (cpls.front()->annotation_text(), "Test_FTR-1_F-119_10_2K_20160524_IOP_OV");
diff --git a/test/read_interop_subtitle_test.cc b/test/read_interop_subtitle_test.cc
index c665bcc2..ba097222 100644
--- a/test/read_interop_subtitle_test.cc
+++ b/test/read_interop_subtitle_test.cc
@@ -53,14 +53,14 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1)
BOOST_CHECK_EQUAL (subs.reel_number(), "1");
BOOST_CHECK_EQUAL (subs.language(), "French");
- list<shared_ptr<dcp::LoadFontNode> > lfn = subs.load_font_nodes ();
+ auto lfn = subs.load_font_nodes ();
BOOST_REQUIRE_EQUAL (lfn.size(), 1);
shared_ptr<dcp::InteropLoadFontNode> interop_lfn = dynamic_pointer_cast<dcp::InteropLoadFontNode> (lfn.front ());
BOOST_REQUIRE (interop_lfn);
BOOST_CHECK_EQUAL (interop_lfn->id, "theFontId");
BOOST_CHECK_EQUAL (interop_lfn->uri, "arial.ttf");
- list<shared_ptr<dcp::Subtitle> > s = subs.subtitles_during (dcp::Time (0, 0, 6, 1, 250), dcp::Time (0, 0, 6, 2, 250), false);
+ auto s = subs.subtitles_during (dcp::Time (0, 0, 6, 1, 250), dcp::Time (0, 0, 6, 2, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 1);
BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
@@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2)
{
dcp::InteropSubtitleAsset subs ("test/data/subs2.xml");
- list<shared_ptr<dcp::Subtitle> > s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false);
+ auto s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
diff --git a/test/read_smpte_subtitle_test.cc b/test/read_smpte_subtitle_test.cc
index 7c367bd4..8fbf0214 100644
--- a/test/read_smpte_subtitle_test.cc
+++ b/test/read_smpte_subtitle_test.cc
@@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test)
BOOST_CHECK_EQUAL (sc.edit_rate(), dcp::Fraction (25, 1));
BOOST_CHECK_EQUAL (sc.time_code_rate(), 25);
BOOST_CHECK_EQUAL (sc.start_time(), dcp::Time (0, 0, 0, 0, 25));
- list<shared_ptr<dcp::LoadFontNode> > lfn = sc.load_font_nodes ();
+ auto lfn = sc.load_font_nodes ();
BOOST_REQUIRE_EQUAL (lfn.size(), 1);
shared_ptr<dcp::SMPTELoadFontNode> smpte_lfn = dynamic_pointer_cast<dcp::SMPTELoadFontNode> (lfn.front ());
BOOST_REQUIRE (smpte_lfn);
@@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test2)
dcp::SMPTESubtitleAsset sc (private_test / "olsson.xml");
BOOST_REQUIRE_EQUAL (sc.subtitles().size(), 6);
- list<shared_ptr<dcp::Subtitle> >::const_iterator i = sc.subtitles().begin();
+ auto i = sc.subtitles().begin();
shared_ptr<dcp::SubtitleString> is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
BOOST_REQUIRE (is);
BOOST_CHECK_EQUAL (is->text(), "Testing is ");
diff --git a/test/rewrite_subs.cc b/test/rewrite_subs.cc
index a6c708e3..0a6f4c6c 100644
--- a/test/rewrite_subs.cc
+++ b/test/rewrite_subs.cc
@@ -61,14 +61,10 @@ main (int argc, char* argv[])
DCP* dcp = new DCP (argv[1]);
dcp->read ();
- list<shared_ptr<CPL> > cpls = dcp->cpls ();
- for (list<std::shared_ptr<CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
-
- list<shared_ptr<Reel> > reels = (*i)->reels ();
- for (list<shared_ptr<Reel> >::iterator j = reels.begin(); j != reels.end(); ++j) {
-
- if ((*j)->main_subtitle()) {
- (*j)->main_subtitle()->asset()->write ((*j)->main_subtitle()->asset()->file().get());
+ for (auto i: dcp->cpls()) {
+ for (auto j: i->reels()) {
+ if (j->main_subtitle()) {
+ j->main_subtitle()->asset()->write(j->main_subtitle()->asset()->file().get());
}
}
}
diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc
index 3fa61fd0..f730485b 100644
--- a/test/round_trip_test.cc
+++ b/test/round_trip_test.cc
@@ -109,10 +109,10 @@ BOOST_AUTO_TEST_CASE (round_trip_test)
/* Check that the decrypted KDMKeys are the same as the ones we started with */
BOOST_CHECK_EQUAL (kdm_A.keys().size(), kdm_B.keys().size());
- list<dcp::DecryptedKDMKey> keys_A = kdm_A.keys ();
- list<dcp::DecryptedKDMKey> keys_B = kdm_B.keys ();
- list<dcp::DecryptedKDMKey>::const_iterator i = keys_A.begin();
- list<dcp::DecryptedKDMKey>::const_iterator j = keys_B.begin();
+ auto keys_A = kdm_A.keys ();
+ auto keys_B = kdm_B.keys ();
+ auto i = keys_A.begin();
+ auto j = keys_B.begin();
while (i != keys_A.end ()) {
BOOST_CHECK (*i == *j);
++i;
diff --git a/test/test.cc b/test/test.cc
index a939f571..8d47dac4 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -65,7 +65,6 @@
using std::string;
using std::min;
-using std::list;
using std::vector;
using std::shared_ptr;
using boost::optional;
@@ -95,7 +94,7 @@ struct TestConfig
};
void
-check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore_tags, bool ignore_whitespace)
+check_xml (xmlpp::Element* ref, xmlpp::Element* test, vector<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 ());
@@ -183,7 +182,7 @@ check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore_tags,
}
void
-check_xml (string ref, string test, list<string> ignore, bool ignore_whitespace)
+check_xml (string ref, string test, vector<string> ignore, bool ignore_whitespace)
{
xmlpp::DomParser* ref_parser = new xmlpp::DomParser ();
ref_parser->parse_memory (ref);
diff --git a/test/test.h b/test/test.h
index 10f99ce1..fb299d1d 100644
--- a/test/test.h
+++ b/test/test.h
@@ -40,8 +40,8 @@ namespace dcp {
extern boost::filesystem::path private_test;
extern boost::filesystem::path xsd_test;
-extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::list<std::string> ignore_tags, bool ignore_whitespace = false);
-extern void check_xml (std::string ref, std::string test, std::list<std::string> ignore, bool ignore_whitespace = false);
+extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::vector<std::string> ignore_tags, bool ignore_whitespace = false);
+extern void check_xml (std::string ref, std::string test, std::vector<std::string> ignore, bool ignore_whitespace = false);
extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
extern std::shared_ptr<dcp::MonoPictureAsset> simple_picture (boost::filesystem::path path, std::string suffix);
extern std::shared_ptr<dcp::SoundAsset> simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language);
diff --git a/test/util_test.cc b/test/util_test.cc
index b82b3f18..21a0d7bc 100644
--- a/test/util_test.cc
+++ b/test/util_test.cc
@@ -38,7 +38,7 @@
using std::ifstream;
using std::string;
-using std::list;
+using std::vector;
/** Test dcp::base64_decode */
BOOST_AUTO_TEST_CASE (base64_decode_test)
@@ -266,7 +266,7 @@ BOOST_AUTO_TEST_CASE (day_greater_than_or_equal_test)
BOOST_AUTO_TEST_CASE (unique_string_test)
{
- list<string> existing;
+ vector<string> existing;
for (int i = 0; i < 16; i++) {
string s;
BOOST_CHECK_NO_THROW (s = dcp::unique_string(existing, "foo"));
diff --git a/test/verify_test.cc b/test/verify_test.cc
index 98a9cd96..4f0fe6f1 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -149,7 +149,7 @@ private:
static
void
-dump_notes (list<dcp::VerificationNote> const & notes)
+dump_notes (vector<dcp::VerificationNote> const & notes)
{
for (auto i: notes) {
std::cout << dcp::note_to_string(i) << "\n";
@@ -900,7 +900,7 @@ BOOST_AUTO_TEST_CASE (verify_various_invalid_languages)
static
-list<dcp::VerificationNote>
+vector<dcp::VerificationNote>
check_picture_size (int width, int height, int frame_rate, bool three_d)
{
using namespace boost::filesystem;
diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc
index deb18339..fee2d841 100644
--- a/test/write_subtitle_test.cc
+++ b/test/write_subtitle_test.cc
@@ -44,10 +44,10 @@
#include "util.h"
#include <boost/test/unit_test.hpp>
-using std::list;
using std::string;
-using boost::optional;
using std::shared_ptr;
+using std::vector;
+using boost::optional;
/** Test dcp::order::Font::take_intersection */
BOOST_AUTO_TEST_CASE (take_intersection_test)
@@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test)
"</Font>"
"</DCSubtitle>",
c.xml_as_string (),
- list<string> ()
+ vector<string>()
);
}
@@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2)
"</Font>"
"</DCSubtitle>",
c.xml_as_string (),
- list<string> ()
+ vector<string>()
);
}
@@ -385,20 +385,20 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3)
check_xml (
dcp::file_to_string("test/ref/write_interop_subtitle_test3/subs.xml"),
dcp::file_to_string("build/test/write_interop_subtitle_test3/subs.xml"),
- list<string>()
+ vector<string>()
);
check_file ("build/test/write_interop_subtitle_test3/d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png", "test/data/sub.png");
check_xml (
dcp::file_to_string("test/ref/write_interop_subtitle_test3/ASSETMAP"),
dcp::file_to_string("build/test/write_interop_subtitle_test3/ASSETMAP"),
- list<string>()
+ vector<string>()
);
check_xml (
dcp::file_to_string("test/ref/write_interop_subtitle_test3/pkl.xml"),
dcp::file_to_string("build/test/write_interop_subtitle_test3/pkl_6a9e31a6-50a4-4ecb-8683-fa667848470a.xml"),
- list<string>()
+ vector<string>()
);
}
@@ -489,7 +489,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test)
"</dcst:SubtitleList>"
"</dcst:SubtitleReel>",
c.xml_as_string (),
- list<string> ()
+ vector<string>()
);
}
@@ -690,7 +690,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2)
"</dcst:Font>"
"</dcst:SubtitleList>"
"</dcst:SubtitleReel>",
- list<string> ()
+ vector<string>()
);
}