Fix rounding of timecodes in at least some cases (#323).
[dcpomatic.git] / test / util_test.cc
index 4dccb49c6c1d95302fb031794b90d1ba97217357..750023d9f1a689bb4414706b66c352a4b6cda2d8 100644 (file)
@@ -25,7 +25,7 @@ using std::string;
 using std::vector;
 using boost::shared_ptr;
 
-BOOST_AUTO_TEST_CASE (util_test)
+BOOST_AUTO_TEST_CASE (split_at_spaces_considering_quotes_test)
 {
        string t = "Hello this is a string \"with quotes\" and indeed without them";
        vector<string> b = split_at_spaces_considering_quotes (t);
@@ -53,3 +53,16 @@ BOOST_AUTO_TEST_CASE (md5_digest_test)
        p.push_back ("foobar");
        BOOST_CHECK_THROW (md5_digest (p, shared_ptr<Job> ()), std::runtime_error);
 }
+
+BOOST_AUTO_TEST_CASE (divide_with_round_test)
+{
+       BOOST_CHECK_EQUAL (divide_with_round (0, 4), 0);
+       BOOST_CHECK_EQUAL (divide_with_round (1, 4), 0);
+       BOOST_CHECK_EQUAL (divide_with_round (2, 4), 1);
+       BOOST_CHECK_EQUAL (divide_with_round (3, 4), 1);
+       BOOST_CHECK_EQUAL (divide_with_round (4, 4), 1);
+       BOOST_CHECK_EQUAL (divide_with_round (5, 4), 1);
+       BOOST_CHECK_EQUAL (divide_with_round (6, 4), 2);
+
+       BOOST_CHECK_EQUAL (divide_with_round (1000, 500), 2);
+}