|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74776 - in trunk/libs/chrono/test: clock stopwatch
From: vicente.botet_at_[hidden]
Date: 2011-10-07 09:42:23
Author: viboes
Date: 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
New Revision: 74776
URL: http://svn.boost.org/trac/boost/changeset/74776
Log:
Chrono: take care of BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
Text files modified:
trunk/libs/chrono/test/clock/clock_pass.cpp | 52 ++++++++++++++++++++++++++++-----------
trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp | 5 +++
trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp | 4 +++
trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp | 4 +++
10 files changed, 73 insertions(+), 16 deletions(-)
Modified: trunk/libs/chrono/test/clock/clock_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/clock/clock_pass.cpp (original)
+++ trunk/libs/chrono/test/clock/clock_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -38,6 +38,8 @@
typename Clock::time_point t1 = Clock::now();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+
template <typename Clock>
void check_clock_now_ec()
{
@@ -52,6 +54,7 @@
typename Clock::time_point t1 = Clock::now(boost::throws());
}
+
template <typename Clock>
void check_clock_now_err(int err)
{
@@ -91,27 +94,22 @@
}
Clock::set_errno(0);
}
+#endif
int main()
{
check_clock_invariants<boost::chrono::high_resolution_clock>();
check_clock_now<boost::chrono::high_resolution_clock>();
- check_clock_now_ec<boost::chrono::high_resolution_clock>();
- check_clock_now_throws<boost::chrono::high_resolution_clock>();
#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
check_clock_invariants<boost::chrono::steady_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::steady_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::steady_clock>();
- check_clock_now_ec<boost::chrono::steady_clock>();
- check_clock_now_throws<boost::chrono::steady_clock>();
#endif
check_clock_invariants<boost::chrono::system_clock>();
BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::system_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::system_clock>();
- check_clock_now_ec<boost::chrono::system_clock>();
- check_clock_now_throws<boost::chrono::system_clock>();
{
typedef boost::chrono::system_clock C;
C::time_point t1 = C::from_time_t(C::to_time_t(C::now()));
@@ -133,35 +131,59 @@
check_clock_invariants<boost::chrono::thread_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::thread_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::thread_clock>();
- check_clock_now_ec<boost::chrono::thread_clock>();
- check_clock_now_throws<boost::chrono::thread_clock>();
#endif
#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
check_clock_invariants<boost::chrono::process_real_cpu_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_real_cpu_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::process_real_cpu_clock>();
- check_clock_now_ec<boost::chrono::process_real_cpu_clock>();
- check_clock_now_throws<boost::chrono::process_real_cpu_clock>();
check_clock_invariants<boost::chrono::process_user_cpu_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_user_cpu_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::process_user_cpu_clock>();
- check_clock_now_ec<boost::chrono::process_user_cpu_clock>();
- check_clock_now_throws<boost::chrono::process_user_cpu_clock>();
check_clock_invariants<boost::chrono::process_system_cpu_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_system_cpu_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::process_system_cpu_clock>();
- check_clock_now_ec<boost::chrono::process_system_cpu_clock>();
- check_clock_now_throws<boost::chrono::process_system_cpu_clock>();
check_clock_invariants<boost::chrono::process_cpu_clock>();
BOOST_CHRONO_STATIC_ASSERT(boost::chrono::process_cpu_clock::is_steady, NOTHING, ());
check_clock_now<boost::chrono::process_cpu_clock>();
+#endif
+
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ check_clock_now_ec<boost::chrono::high_resolution_clock>();
+ check_clock_now_throws<boost::chrono::high_resolution_clock>();
+
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ check_clock_now_ec<boost::chrono::steady_clock>();
+ check_clock_now_throws<boost::chrono::steady_clock>();
+#endif
+
+ check_clock_now_ec<boost::chrono::system_clock>();
+ check_clock_now_throws<boost::chrono::system_clock>();
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ check_clock_now_ec<boost::chrono::thread_clock>();
+ check_clock_now_throws<boost::chrono::thread_clock>();
+#endif
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ check_clock_now_ec<boost::chrono::process_real_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_real_cpu_clock>();
+
+ check_clock_now_ec<boost::chrono::process_user_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_user_cpu_clock>();
+
+ check_clock_now_ec<boost::chrono::process_system_cpu_clock>();
+ check_clock_now_throws<boost::chrono::process_system_cpu_clock>();
+
check_clock_now_ec<boost::chrono::process_cpu_clock>();
check_clock_now_throws<boost::chrono::process_cpu_clock>();
#endif
-
+
+#endif
+
return boost::report_errors();
}
Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -53,6 +53,7 @@
BOOST_TEST(boost::accumulators::count(sw.get_laps_collector().accumulator_set())==0);
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -72,6 +73,7 @@
BOOST_TEST(sw.get_laps_collector().last()==Stopwatch::duration::zero());
BOOST_TEST(boost::accumulators::count(sw.get_laps_collector().accumulator_set())==0);
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -197,8 +199,10 @@
{
check_invariants<Stopwatch>();
check_default_constructor<Stopwatch>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Stopwatch>();
check_constructor_throws<Stopwatch>();
+#endif
check_elapsed<Stopwatch>();
check_start_start<Stopwatch>();
Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -53,6 +53,7 @@
BOOST_TEST(sw.get_laps_collector().container().size()==0);
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -72,6 +73,7 @@
BOOST_TEST(sw.get_laps_collector().last()==Stopwatch::duration::zero());
BOOST_TEST(sw.get_laps_collector().container().size()==0);
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -197,8 +199,10 @@
{
check_invariants<Stopwatch>();
check_default_constructor<Stopwatch>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Stopwatch>();
check_constructor_throws<Stopwatch>();
+#endif
check_elapsed<Stopwatch>();
check_start_start<Stopwatch>();
Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -51,6 +51,7 @@
BOOST_TEST(sw.get_laps_collector().last()==Stopwatch::duration::zero());
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -68,6 +69,7 @@
BOOST_TEST(sw.is_running());
BOOST_TEST(sw.get_laps_collector().last()==Stopwatch::duration::zero());
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -199,8 +201,10 @@
{
check_invariants<Stopwatch>();
check_default_constructor<Stopwatch>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Stopwatch>();
check_constructor_throws<Stopwatch>();
+#endif
check_elapsed<Stopwatch>();
check_start_start<Stopwatch>();
Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -48,6 +48,7 @@
BOOST_TEST(d == Stopwatch::duration::zero());
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -63,6 +64,7 @@
Stopwatch sw(boost::throws());
BOOST_TEST(sw.is_running());
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -173,8 +175,10 @@
{
check_invariants<Stopwatch>();
check_default_constructor<Stopwatch>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Stopwatch>();
check_constructor_throws<Stopwatch>();
+#endif
check_elapsed<Stopwatch>();
check_start_start<Stopwatch>();
Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -57,6 +57,7 @@
BOOST_TEST(d == Stopwatch::duration::zero());
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -72,6 +73,7 @@
Stopwatch sw(boost::throws());
BOOST_TEST(sw.is_running());
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -229,8 +231,10 @@
check_invariants<Reporter>();
check_default_constructor<Reporter>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Reporter>();
check_constructor_throws<Reporter>();
+#endif
check_elapsed<Reporter>();
check_report<Reporter>();
Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -55,6 +55,7 @@
BOOST_TEST(d == Stopwatch::duration::zero());
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -70,6 +71,7 @@
Stopwatch sw(boost::throws());
BOOST_TEST(sw.is_running());
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -227,8 +229,10 @@
check_invariants<Reporter>();
check_default_constructor<Reporter>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Reporter>();
check_constructor_throws<Reporter>();
+#endif
check_elapsed<Reporter>();
check_report<Reporter>();
Modified: trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -37,6 +37,7 @@
Stopwatch _;
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -50,7 +51,7 @@
{
Stopwatch _(boost::throws());
}
-
+#endif
template <typename Stopwatch>
void check_elapsed(bool check=true)
@@ -68,8 +69,10 @@
typedef boost::chrono::simple_stopwatch<Clock> Stopwatch;
check_invariants<Stopwatch>();
check_default_constructor<Stopwatch>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Stopwatch>();
check_constructor_throws<Stopwatch>();
+#endif
check_elapsed<Stopwatch>(check);
}
Modified: trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -79,6 +79,7 @@
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Reporter>
void check_constructor_ec()
{
@@ -92,6 +93,7 @@
{
Reporter _(boost::throws());
}
+#endif
template <typename Reporter>
void check_elapsed(bool check=true)
@@ -120,8 +122,10 @@
check_invariants<Reporter>();
check_default_constructor<Reporter>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Reporter>();
check_constructor_throws<Reporter>();
+#endif
check_elapsed<Reporter>(check);
check_report<Reporter>();
check_file_line<ReporterE>();
Modified: trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp 2011-10-07 09:42:21 EDT (Fri, 07 Oct 2011)
@@ -48,6 +48,7 @@
BOOST_TEST(d == Stopwatch::duration::zero());
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
template <typename Stopwatch>
void check_constructor_ec()
{
@@ -63,6 +64,7 @@
Stopwatch sw(boost::throws());
BOOST_TEST(sw.is_running());
}
+#endif
template <typename Stopwatch>
void check_elapsed()
@@ -253,8 +255,10 @@
typedef boost::chrono::suspendable_stopwatch<Clock> Stopwatch;
check_invariants<Stopwatch>();
check_default_constructor<Stopwatch>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
check_constructor_ec<Stopwatch>();
check_constructor_throws<Stopwatch>();
+#endif
check_elapsed<Stopwatch>();
check_start_start<Stopwatch>();
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