diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-15 23:52:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-12-15 23:52:43 +0100 |
| commit | 16ff53a37012b52b4ccc39d87a383e10f7e5cbb8 (patch) | |
| tree | ec362dadbd30db43974b08346199e575d2a2e29b | |
| parent | d1616c08c253293ecb864ae0774927a1ec7b1b77 (diff) | |
Tidy up find_cpl() and add find_pkl().
| -rw-r--r-- | test/verify_test.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/test/verify_test.cc b/test/verify_test.cc index 02067cf3..52d774bd 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -963,19 +963,32 @@ BOOST_AUTO_TEST_CASE (verify_valid_cpl_metadata) } +path +find_prefix(path dir, string prefix) +{ + auto iter = std::find_if(directory_iterator(dir), directory_iterator(), [prefix](path const& p) { + return boost::starts_with(p.filename().string(), prefix); + }); + + BOOST_REQUIRE(iter != directory_iterator()); + return iter->path(); +} + + path find_cpl (path dir) { - for (auto i: directory_iterator(dir)) { - if (boost::starts_with(i.path().filename().string(), "cpl_")) { - return i.path(); - } - } + return find_prefix(dir, "cpl_"); +} + - BOOST_REQUIRE (false); - return {}; +path +find_pkl(path dir) +{ + return find_prefix(dir, "pkl_"); } + /* DCP with invalid CompositionMetadataAsset */ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) { |
