diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-25 00:13:55 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-15 23:18:58 +0200 |
| commit | b786ec52435a697f7bcc2ef1870f22e27e446315 (patch) | |
| tree | 0a2a2ad040e5a73350b853d190acd3277fecd1cd /test/frame_info_hash_test.cc | |
| parent | 7cb07bcec10bfdfed3e82a2dc138114dc6a5ac68 (diff) | |
FIXME: Hash to a vector rather than a string.2758-safe-write
Needs asdcplib version bump.
Diffstat (limited to 'test/frame_info_hash_test.cc')
| -rw-r--r-- | test/frame_info_hash_test.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/frame_info_hash_test.cc b/test/frame_info_hash_test.cc index 331eabf1..edf89f5c 100644 --- a/test/frame_info_hash_test.cc +++ b/test/frame_info_hash_test.cc @@ -44,10 +44,11 @@ using std::make_shared; using std::shared_ptr; using std::string; +using std::vector; static void -check (shared_ptr<dcp::J2KPictureAssetWriter> writer, boost::random::uniform_int_distribution<>& dist, boost::random::mt19937& rng, string hash) +check(shared_ptr<dcp::J2KPictureAssetWriter> writer, boost::random::uniform_int_distribution<>& dist, boost::random::mt19937& rng, vector<uint8_t> hash) { auto xyz = make_shared<dcp::OpenJPEGImage>(dcp::Size(1998, 1080)); for (int c = 0; c < 3; ++c) { @@ -59,7 +60,7 @@ check (shared_ptr<dcp::J2KPictureAssetWriter> writer, boost::random::uniform_int auto data = dcp::compress_j2k (xyz, 100000000, 24, false, false); auto info = writer->write (data.data(), data.size()); - BOOST_CHECK_EQUAL (info.hash, hash); + BOOST_CHECK(info.hash == hash); } @@ -73,7 +74,7 @@ BOOST_AUTO_TEST_CASE (frame_info_hash_test) boost::random::uniform_int_distribution<> dist(0, 4095); /* Check a few random frames */ - check(writer, dist, rng, "8f3dc7321d6dff3d5691011de31fc713"); - check(writer, dist, rng, "a305b83a40367fda1b5cf0efa096fd18"); - check(writer, dist, rng, "1abc71e011ced46d9928a4b2d22e20f6"); + check(writer, dist, rng, vector<uint8_t>{0x8f, 0x3d, 0xc7, 0x32, 0x1d, 0x6d, 0xff, 0x3d, 0x56, 0x91, 0x01, 0x1d, 0xe3, 0x1f, 0xc7, 0x13}); + check(writer, dist, rng, vector<uint8_t>{0xa3, 0x05, 0xb8, 0x3a, 0x40, 0x36, 0x7f, 0xda, 0x1b, 0x5c, 0xf0, 0xef, 0xa0, 0x96, 0xfd, 0x18}); + check(writer, dist, rng, vector<uint8_t>{0x1a, 0xbc, 0x71, 0xe0, 0x11, 0xce, 0xd4, 0x6d, 0x99, 0x28, 0xa4, 0xb2, 0xd2, 0x2e, 0x20, 0xf6}); } |
