Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75149 - trunk/libs/chrono/test/io
From: vicente.botet_at_[hidden]
Date: 2011-10-27 18:55:54


Author: viboes
Date: 2011-10-27 18:55:52 EDT (Thu, 27 Oct 2011)
New Revision: 75149
URL: http://svn.boost.org/trac/boost/changeset/75149

Log:
Chrono: Adapt test to new I/O implementation
Text files modified:
   trunk/libs/chrono/test/io/duration_input.cpp | 2 +-
   trunk/libs/chrono/test/io/duration_output.cpp | 17 ++++++++---------
   trunk/libs/chrono/test/io/time_point_output.cpp | 6 ++++++
   3 files changed, 15 insertions(+), 10 deletions(-)

Modified: trunk/libs/chrono/test/io/duration_input.cpp
==============================================================================
--- trunk/libs/chrono/test/io/duration_input.cpp (original)
+++ trunk/libs/chrono/test/io/duration_input.cpp 2011-10-27 18:55:52 EDT (Thu, 27 Oct 2011)
@@ -17,7 +17,7 @@
 }
 
 template<typename DFail, typename DGood>
-void test_fail(const char* str, DFail r, DGood res)
+void test_fail(const char* str, DFail, DGood res)
 {
   {
     std::istringstream in(str);

Modified: trunk/libs/chrono/test/io/duration_output.cpp
==============================================================================
--- trunk/libs/chrono/test/io/duration_output.cpp (original)
+++ trunk/libs/chrono/test/io/duration_output.cpp 2011-10-27 18:55:52 EDT (Thu, 27 Oct 2011)
@@ -28,6 +28,7 @@
 void test_good(const char* str, D d, boost::chrono::duration_style::type style)
 {
   std::ostringstream out;
+
   out << boost::chrono::duration_fmt(style) << d;
   BOOST_TEST(out.good());
   BOOST_TEST(out.str() == str);
@@ -36,25 +37,17 @@
 template<typename D>
 void test_state_saver(const char* str, const char* str2, D d, boost::chrono::duration_style::type style)
 {
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
   std::ostringstream out;
   {
     boost::chrono::duration_style_io_saver<> ios(out);
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
     out << boost::chrono::duration_fmt(style) << d;
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
     BOOST_TEST(out.good());
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
     BOOST_TEST(out.str() == str);
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
   }
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
   out << " " << d;
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
   BOOST_TEST(out.good());
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
   BOOST_TEST(out.str() == str2);
- std::cout << __FILE__ << ":" << __LINE__ << std::endl;
+ //std::cout << __FILE__ << ":" << __LINE__ << std::endl;
 }
 
 int main()
@@ -68,8 +61,14 @@
   test_good_prefix("5000 hours", hours(5000));
   test_good_prefix("5000 minutes", minutes(5000));
   test_good_prefix("5000 seconds", seconds(5000));
+ test_good_prefix("0 seconds", seconds(0));
+#if !defined BOOST_CHRONO_IO_V1_DONT_PROVIDE_DEPRECATED
   test_good_prefix("1 seconds", seconds(1));
   test_good_prefix("-1 seconds", seconds(-1));
+#else
+ test_good_prefix("1 second", seconds(1));
+ test_good_prefix("-1 second", seconds(-1));
+#endif
   test_good_prefix("5000 milliseconds", milliseconds(5000));
   test_good_prefix("5000 microseconds", microseconds(5000));
   test_good_prefix("5000 nanoseconds", nanoseconds(5000));

Modified: trunk/libs/chrono/test/io/time_point_output.cpp
==============================================================================
--- trunk/libs/chrono/test/io/time_point_output.cpp (original)
+++ trunk/libs/chrono/test/io/time_point_output.cpp 2011-10-27 18:55:52 EDT (Thu, 27 Oct 2011)
@@ -51,8 +51,14 @@
   test_good_prefix<Clock>("2 hours", hours(2));
   test_good_prefix<Clock>("2 minutes", minutes(2));
   test_good_prefix<Clock>("2 seconds", seconds(2));
+#if !defined BOOST_CHRONO_IO_V1_DONT_PROVIDE_DEPRECATED
   test_good_prefix<Clock>("1 seconds", seconds(1));
   test_good_prefix<Clock>("-1 seconds", seconds(-1));
+#else
+ test_good_prefix<Clock>("1 second", seconds(1));
+ test_good_prefix<Clock>("-1 second", seconds(-1));
+#endif
+ test_good_prefix<Clock>("0 seconds", seconds(0));
   test_good_prefix<Clock>("2 milliseconds", milliseconds(2));
   test_good_prefix<Clock>("2 microseconds", microseconds(2));
   test_good_prefix<Clock>("2 nanoseconds", nanoseconds(2));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk