diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-21 16:04:57 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-21 16:04:57 +0100 |
| commit | 99d72a19f9e5ebbbb36bbbb95164a15c165a6a42 (patch) | |
| tree | eecb904bb0c46a318bc0fc1d7aad70b7eaf72ff4 /test | |
| parent | de49deb8b65bad47fda93a04fab2e97b10d48a75 (diff) | |
Add some add() methods to Time classes.
Diffstat (limited to 'test')
| -rw-r--r-- | test/time_test.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/time_test.cc b/test/time_test.cc index fc852b1..d6ca14a 100644 --- a/test/time_test.cc +++ b/test/time_test.cc @@ -67,3 +67,21 @@ BOOST_AUTO_TEST_CASE (time_conversion_test) p.set_frame (sub::FrameTime (3, 5, 7, 3)); BOOST_CHECK_EQUAL (p.metric (25), sub::MetricTime (3, 5, 7, 120)); } + +/* Check time maths */ +BOOST_AUTO_TEST_CASE (time_maths_test) +{ + { + sub::FrameTime a (1, 59, 59, 23); + sub::FrameTime b (2, 31, 19, 2); + a.add (b, 24); + BOOST_CHECK_EQUAL (a, sub::FrameTime (4, 31, 19, 1)); + } + + { + sub::MetricTime a (1, 59, 59, 999); + sub::MetricTime b (2, 31, 19, 2); + a.add (b); + BOOST_CHECK_EQUAL (a, sub::MetricTime (4, 31, 19, 1)); + } +} |
