class library: Reset has been renamed to OnError
[supercollider.git] / testsuite / supernova / timetag_test.cpp
blobaffa5dd55281acfa528c32bef8afd9c58d218b5a
1 #include <boost/test/unit_test.hpp>
3 #include "utilities/time_tag.hpp"
5 #include "boost/date_time/posix_time/posix_time.hpp"
7 using namespace nova;
8 using namespace boost;
10 BOOST_AUTO_TEST_CASE( time_tag_test_1 )
13 time_tag tt;
14 BOOST_REQUIRE_EQUAL(tt.get_secs(), 0u);
15 BOOST_REQUIRE_EQUAL(tt.get_fraction(), 0u);
19 time_tag tt(100, 200);
20 BOOST_REQUIRE_EQUAL(tt.get_secs(), 100u);
21 BOOST_REQUIRE_EQUAL(tt.get_fraction(), 200u);
25 time_tag t1(0, 0);
26 time_tag t2(0, 1);
27 time_tag t3(0, 1);
29 BOOST_REQUIRE(t1 < t2);
30 BOOST_REQUIRE(t1 != t2);
31 BOOST_REQUIRE(t2 == t3);
35 time_tag t1(0, 0);
36 time_tag t2(1, 0);
38 time_tag t3 = t1 + t2;
39 BOOST_REQUIRE(t2 == t3);
41 t3 += t2;
42 BOOST_REQUIRE(t3 == time_tag(2, 0));
46 BOOST_AUTO_TEST_CASE( time_tag_test_2 )
48 using namespace boost::posix_time;
49 time_tag first = time_tag::from_ptime(ptime(microsec_clock::universal_time()));
50 time_tag next = time_tag::from_ptime(ptime(microsec_clock::universal_time()));
52 BOOST_REQUIRE(first <= next);
55 BOOST_AUTO_TEST_CASE( time_tag_test_3 )
57 using namespace boost::posix_time;
58 time_tag now = time_tag::from_ptime(ptime(microsec_clock::universal_time()));
60 ptime pnow = now.to_ptime();
62 /* std::cout << now.get_secs() << std::endl; */
63 /* std::cout << pnow << std::endl; */