+
+ /* Corrupt the hashes in the CPL and check that the disagreement between CPL and PKL is spotted */
+ string const cpl = dcp::file_to_string (cpl_file);
+ string hacked_cpl = "";
+ for (size_t i = 0; i < (cpl.length() - 6); ++i) {
+ if (cpl.substr(i, 6) == "<Hash>") {
+ hacked_cpl += "<Hash>x";
+ i += 6;
+ } else {
+ hacked_cpl += cpl[i];
+ }
+ }
+ hacked_cpl += "list>";
+
+ FILE* f = fopen(cpl_file.string().c_str(), "w");
+ fwrite(hacked_cpl.c_str(), hacked_cpl.length(), 1, f);
+ fclose(f);
+
+ notes = dcp::verify (directories, &stage, &progress);
+ BOOST_CHECK_EQUAL (notes.size(), 2);
+ BOOST_CHECK_EQUAL (notes.front().type(), dcp::VerificationNote::VERIFY_ERROR);
+ BOOST_CHECK_EQUAL (notes.front().note(), "PKL and CPL hashes differ for picture asset.");
+ BOOST_CHECK_EQUAL (notes.back().type(), dcp::VerificationNote::VERIFY_ERROR);
+ BOOST_CHECK_EQUAL (notes.back().note(), "PKL and CPL hashes differ for sound asset.");
+