Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66125 - in sandbox/chrono/libs/chrono/test: . clock clock/errored
From: vicente.botet_at_[hidden]
Date: 2010-10-20 18:04:23


Author: viboes
Date: 2010-10-20 18:04:22 EDT (Wed, 20 Oct 2010)
New Revision: 66125
URL: http://svn.boost.org/trac/boost/changeset/66125

Log:
Chrono: Fix errored_clock

Text files modified:
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 1 -
   sandbox/chrono/libs/chrono/test/clock/check_clock_now.hpp | 1 +
   sandbox/chrono/libs/chrono/test/clock/errored/now.pass.cpp | 3 ++-
   sandbox/chrono/libs/chrono/test/clock/errored_clock.hpp | 10 ++++++++++
   4 files changed, 13 insertions(+), 2 deletions(-)

Modified: sandbox/chrono/libs/chrono/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/chrono/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/chrono/test/Jamfile.v2 2010-10-20 18:04:22 EDT (Wed, 20 Oct 2010)
@@ -35,7 +35,6 @@
         #<include>../../..
 
         <toolset>msvc:<asynch-exceptions>on
- <define>BOOST_ENABLE_WARNINGS
         <define>BOOST_CHRONO_USES_MPL_ASSERT
         <define>BOOST_SYSTEM_NO_DEPRECATED
         <warnings>all

Modified: sandbox/chrono/libs/chrono/test/clock/check_clock_now.hpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/clock/check_clock_now.hpp (original)
+++ sandbox/chrono/libs/chrono/test/clock/check_clock_now.hpp 2010-10-20 18:04:22 EDT (Wed, 20 Oct 2010)
@@ -60,6 +60,7 @@
     Clock::set_errno(err);
     try {
         typename Clock::time_point t1 = Clock::now(boost::throws());
+ BOOST_TEST(0&&"exception not thown");
     } catch (boost::system::system_error& ex) {
         BOOST_TEST(ex.code().value()==err);
 // BOOST_TEST(ex.code().category() == BOOST_CHRONO_SYSTEM_CATEGORY);

Modified: sandbox/chrono/libs/chrono/test/clock/errored/now.pass.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/clock/errored/now.pass.cpp (original)
+++ sandbox/chrono/libs/chrono/test/clock/errored/now.pass.cpp 2010-10-20 18:04:22 EDT (Wed, 20 Oct 2010)
@@ -9,7 +9,8 @@
 int main()
 {
         check_clock_now_err<errored_clock>(1);
- check_clock_now_ec_err<errored_clock>(1);
+ check_clock_now_ec_err<errored_clock>(1);
+ check_clock_now_throws_err<errored_clock>(1);
 
     return boost::report_errors();
 }

Modified: sandbox/chrono/libs/chrono/test/clock/errored_clock.hpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/clock/errored_clock.hpp (original)
+++ sandbox/chrono/libs/chrono/test/clock/errored_clock.hpp 2010-10-20 18:04:22 EDT (Wed, 20 Oct 2010)
@@ -43,6 +43,16 @@
       }
       // never throws and set ec
       static time_point now(boost::system::error_code & ec) {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ boost::throw_exception(
+ boost::system::system_error(
+ errno_,
+ BOOST_CHRONO_SYSTEM_CATEGORY,
+ "errored_clock"
+ )
+ );
+ }
               ec.assign( errno_, BOOST_CHRONO_SYSTEM_CATEGORY );
               return time_point();
       };


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