Move some tests and rename one set.
[libdcp.git] / test / frame_info_hash_test.cc
index 1713963b39effa4507578e2ee33fe9511ce586de..ed440af5a5024016d65672c1ef4ba4f378e14aef 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
 
     You should have received a copy of the GNU General Public License
     along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the
+    OpenSSL library under certain conditions as described in each
+    individual source file, and distribute linked combinations
+    including the two.
+
+    You must obey the GNU General Public License in all respects
+    for all of the code used other than OpenSSL.  If you modify
+    file(s) with this exception, you may extend this exception to your
+    version of the file(s), but you are not obligated to do so.  If you
+    do not wish to do so, delete this exception statement from your
+    version.  If you delete this exception statement from all source
+    files in the program, then also delete it here.
 */
 
 #include "mono_picture_asset.h"
@@ -32,7 +46,7 @@ check (unsigned int* seed, shared_ptr<dcp::PictureAssetWriter> writer, string ha
        shared_ptr<dcp::OpenJPEGImage> xyz (new dcp::OpenJPEGImage (dcp::Size (1998, 1080)));
        for (int c = 0; c < 3; ++c) {
                for (int p = 0; p < (1998 * 1080); ++p) {
-                       xyz->data(c)[p] = rand_r (seed);
+                       xyz->data(c)[p] = rand_r (seed) & 0xfff;
                }
        }
 
@@ -45,13 +59,13 @@ check (unsigned int* seed, shared_ptr<dcp::PictureAssetWriter> writer, string ha
 /** Test the hashing of data written to JPEG2000 MXFs with some random inputs */
 BOOST_AUTO_TEST_CASE (frame_info_hash_test)
 {
-       shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (dcp::Fraction (24, 1)));
-       shared_ptr<dcp::PictureAssetWriter> writer = mp->start_write ("build/test/frame_info_hash_test.mxf", dcp::SMPTE, false);
+       shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (dcp::Fraction (24, 1), dcp::SMPTE));
+       shared_ptr<dcp::PictureAssetWriter> writer = mp->start_write ("build/test/frame_info_hash_test.mxf", false);
 
        unsigned int seed = 42;
 
        /* Check a few random frames */
-       check (&seed, writer, "7ddfb4f5cec76f95138c4377a829dd6f");
-       check (&seed, writer, "d6a91028bab60995b4fc49fbccd5c2ba");
-       check (&seed, writer, "9d8653644f49f692e4bbac34106a4897");
+       check (&seed, writer, "c039c5a0e5d20bc646f7e9c10e2d5874");
+       check (&seed, writer, "d9e694cfe84544c54a869c128ba39343");
+       check (&seed, writer, "fafb05a0039cb9fc604279c90a13cb87");
 }