From: Philipp Gesang Date: Fri, 26 Apr 2019 15:00:12 +0000 (+0200) Subject: unit test Time::operator<< X-Git-Tag: v2.12~4^2 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=e4253dd6934e1f1bc40bae41d19cc12c3b1023d4;p=libi2ncommon unit test Time::operator<< --- diff --git a/test/test_timefunc.cpp b/test/test_timefunc.cpp index 74174c7..5705c22 100644 --- a/test/test_timefunc.cpp +++ b/test/test_timefunc.cpp @@ -44,6 +44,7 @@ on this file might be covered by the GNU General Public License. #include #include #include +#include using namespace std; using namespace I2n; @@ -1524,6 +1525,24 @@ BOOST_AUTO_TEST_SUITE(Clock) BOOST_CHECK_EQUAL(I2n::clock::median (ts), I2n::clock::Time (0xf00d)); } + BOOST_AUTO_TEST_CASE(operator_shift_left) + { + std::ostringstream os1; + std::ostringstream os2; + std::ostringstream os3; + std::ostringstream os4; + + os1 << I2n::clock::Time ( 42, 42); + os2 << I2n::clock::Time (-42, 42); + os3 << I2n::clock::Time ( 42, -42); + os4 << I2n::clock::Time (-42, -42); + + BOOST_CHECK_EQUAL(os1.str (), "42s, 42ns"); + BOOST_CHECK_EQUAL(os2.str (), "-42s, 42ns"); + BOOST_CHECK_EQUAL(os3.str (), "41s, 999999958ns"); + BOOST_CHECK_EQUAL(os4.str (), "-43s, 999999958ns"); + } + BOOST_AUTO_TEST_SUITE_END() /* [Clock] */ BOOST_AUTO_TEST_SUITE_END()