Fix potential very rare test failure.
[dcpomatic.git] / test / util_test.cc
index 67c1a5265f03f4711800436945e63087e9b82bcc..b0abe04c9f47495261ede1985640aca0aedeb44c 100644 (file)
@@ -139,7 +139,7 @@ progress (float p)
 BOOST_AUTO_TEST_CASE (copy_in_bits_test)
 {
        for (int i = 0; i < 32; ++i) {
-               make_random_file ("build/test/random.dat", rand() % (256 * 1024 * 1024));
+               make_random_file ("build/test/random.dat", std::max(1, rand() % (256 * 1024 * 1024)));
 
                progress_values.clear ();
                copy_in_bits ("build/test/random.dat", "build/test/random.dat2", boost::bind(&progress, _1));