summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-02-05 16:35:34 +0000
committerCarl Hetherington <cth@carlh.net>2014-02-05 16:35:34 +0000
commit6c5e5435d105685a537561ca0e6a223d34af85e1 (patch)
treeb2415a607f5fdaadc4a37edb7e7a68a5ef0bc7cc /test
parent095dcf9a0fb075ca84537beff2fe6a41c837e8da (diff)
Support for conversions of things that have multiple representations.
Diffstat (limited to 'test')
-rw-r--r--test/time_test.cc33
-rw-r--r--test/wscript1
2 files changed, 34 insertions, 0 deletions
diff --git a/test/time_test.cc b/test/time_test.cc
new file mode 100644
index 0000000..a42fc9d
--- /dev/null
+++ b/test/time_test.cc
@@ -0,0 +1,33 @@
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/test/unit_test.hpp>
+#include "metric_time.h"
+#include "frame_time.h"
+#include "convert_time.h"
+
+/* Check time conversions */
+BOOST_AUTO_TEST_CASE (time_test)
+{
+ BOOST_CHECK_EQUAL (metric_to_frame (sub::MetricTime (3, 5, 7, 40), 25), sub::FrameTime (3, 5, 7, 1));
+ BOOST_CHECK_EQUAL (frame_to_metric (sub::FrameTime (3, 5, 7, 1), 25), sub::MetricTime (3, 5, 7, 40));
+ BOOST_CHECK_EQUAL (metric_to_frame (sub::MetricTime (3, 5, 7, 120), 25), sub::FrameTime (3, 5, 7, 3));
+ BOOST_CHECK_EQUAL (frame_to_metric (sub::FrameTime (3, 5, 7, 3), 25), sub::MetricTime (3, 5, 7, 120));
+}
+
diff --git a/test/wscript b/test/wscript
index 2954352..96a7428 100644
--- a/test/wscript
+++ b/test/wscript
@@ -19,6 +19,7 @@ def build(bld):
dcp_reader_test.cc
stl_reader_test.cc
stl_writer_test.cc
+ time_test.cc
test.cc
"""
obj.target = 'tests'