From d225c1a326a8e812ec9260239f5aaf70b963c00f Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 26 Apr 2019 17:00:12 +0200 Subject: [PATCH] unit test Time::operator<< --- test/test_timefunc.cpp | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) 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() -- 1.7.1