Move a couple of tests to a more appropriate place.
authorCarl Hetherington <cth@carlh.net>
Thu, 18 Jan 2018 00:25:59 +0000 (00:25 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 18 Jan 2018 00:25:59 +0000 (00:25 +0000)
src/lib/dcpomatic_time.h
test/dcpomatic_time_test.cc
test/util_test.cc

index ad5b6768edb1140c9ac04570bab6f8a8af1651b2..5f00807bdf2c3c4da605e577e3c18f7214d90391 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -218,8 +218,8 @@ public:
        }
 
 private:
-       friend struct dcptime_ceil_test;
-       friend struct dcptime_floor_test;
+       friend struct dcpomatic_time_ceil_test;
+       friend struct dcpomatic_time_floor_test;
 
        Type _t;
        static const int HZ = 96000;
index 38b4d31a99c74d880e81c6e7969264ed07811683..94d51503552f93018494b10c472644d33e1f7840 100644 (file)
@@ -300,3 +300,37 @@ BOOST_AUTO_TEST_CASE (dcpomatic_time_period_coalesce_test5)
        BOOST_CHECK (q.front() == DCPTimePeriod(DCPTime(14), DCPTime(91)));
        BOOST_CHECK (q.back()  == DCPTimePeriod(DCPTime(100), DCPTime(106)));
 }
+
+/* Straightforward test of DCPTime::ceil */
+BOOST_AUTO_TEST_CASE (dcpomatic_time_ceil_test)
+{
+       BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 2).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 2).get(), 2);
+       BOOST_CHECK_EQUAL (DCPTime(2).ceil(DCPTime::HZ / 2).get(), 2);
+       BOOST_CHECK_EQUAL (DCPTime(3).ceil(DCPTime::HZ / 2).get(), 4);
+
+       BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 42).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 42).get(), 42);
+       BOOST_CHECK_EQUAL (DCPTime(42).ceil(DCPTime::HZ / 42).get(), 42);
+       BOOST_CHECK_EQUAL (DCPTime(43).ceil(DCPTime::HZ / 42).get(), 84);
+
+       /* Check that rounding up to non-integer frame rates works */
+       BOOST_CHECK_EQUAL (DCPTime(45312).ceil(29.976).get(), 48038);
+}
+
+/* Straightforward test of DCPTime::floor */
+BOOST_AUTO_TEST_CASE (dcpomatic_time_floor_test)
+{
+       BOOST_CHECK_EQUAL (DCPTime(0).floor(DCPTime::HZ / 2).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(1).floor(DCPTime::HZ / 2).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(2).floor(DCPTime::HZ / 2).get(), 2);
+       BOOST_CHECK_EQUAL (DCPTime(3).floor(DCPTime::HZ / 2).get(), 2);
+
+       BOOST_CHECK_EQUAL (DCPTime(0).floor(DCPTime::HZ / 42).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(1).floor(DCPTime::HZ / 42).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(42).floor(DCPTime::HZ / 42.0).get(), 42);
+       BOOST_CHECK_EQUAL (DCPTime(43).floor(DCPTime::HZ / 42.0).get(), 42);
+
+       /* Check that rounding down to non-integer frame rates works */
+       BOOST_CHECK_EQUAL (DCPTime(45312).floor(29.976).get(), 44836);
+}
index a605c3548cc5ff3a8b2d6c49e860b3a3ab9276e3..e0e70f902c4d0b8bbc7edbbdc39490d8521ea45c 100644 (file)
@@ -52,40 +52,6 @@ BOOST_AUTO_TEST_CASE (digest_head_tail_test)
        BOOST_CHECK_THROW (digest_head_tail (p, 1024), OpenFileError);
 }
 
-/* Straightforward test of DCPTime::ceil */
-BOOST_AUTO_TEST_CASE (dcptime_ceil_test)
-{
-       BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 2).get(), 0);
-       BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 2).get(), 2);
-       BOOST_CHECK_EQUAL (DCPTime(2).ceil(DCPTime::HZ / 2).get(), 2);
-       BOOST_CHECK_EQUAL (DCPTime(3).ceil(DCPTime::HZ / 2).get(), 4);
-
-       BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 42).get(), 0);
-       BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 42).get(), 42);
-       BOOST_CHECK_EQUAL (DCPTime(42).ceil(DCPTime::HZ / 42).get(), 42);
-       BOOST_CHECK_EQUAL (DCPTime(43).ceil(DCPTime::HZ / 42).get(), 84);
-
-       /* Check that rounding up to non-integer frame rates works */
-       BOOST_CHECK_EQUAL (DCPTime(45312).ceil(29.976).get(), 48038);
-}
-
-/* Straightforward test of DCPTime::floor */
-BOOST_AUTO_TEST_CASE (dcptime_floor_test)
-{
-       BOOST_CHECK_EQUAL (DCPTime(0).floor(DCPTime::HZ / 2).get(), 0);
-       BOOST_CHECK_EQUAL (DCPTime(1).floor(DCPTime::HZ / 2).get(), 0);
-       BOOST_CHECK_EQUAL (DCPTime(2).floor(DCPTime::HZ / 2).get(), 2);
-       BOOST_CHECK_EQUAL (DCPTime(3).floor(DCPTime::HZ / 2).get(), 2);
-
-       BOOST_CHECK_EQUAL (DCPTime(0).floor(DCPTime::HZ / 42).get(), 0);
-       BOOST_CHECK_EQUAL (DCPTime(1).floor(DCPTime::HZ / 42).get(), 0);
-       BOOST_CHECK_EQUAL (DCPTime(42).floor(DCPTime::HZ / 42.0).get(), 42);
-       BOOST_CHECK_EQUAL (DCPTime(43).floor(DCPTime::HZ / 42.0).get(), 42);
-
-       /* Check that rounding down to non-integer frame rates works */
-       BOOST_CHECK_EQUAL (DCPTime(45312).floor(29.976).get(), 44836);
-}
-
 BOOST_AUTO_TEST_CASE (timecode_test)
 {
        DCPTime t = DCPTime::from_seconds (2 * 60 * 60 + 4 * 60 + 31) + DCPTime::from_frames (19, 24);