1 #include <boost/test/unit_test.hpp>
3 #include "utilities/time_tag.hpp"
5 #include "boost/date_time/posix_time/posix_time.hpp"
10 BOOST_AUTO_TEST_CASE( time_tag_test_1
)
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);
29 BOOST_REQUIRE(t1
< t2
);
30 BOOST_REQUIRE(t1
!= t2
);
31 BOOST_REQUIRE(t2
== t3
);
38 time_tag t3
= t1
+ t2
;
39 BOOST_REQUIRE(t2
== t3
);
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; */