Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68675 - in sandbox/chrono/libs/stopwatches: example test
From: vicente.botet_at_[hidden]
Date: 2011-02-06 12:21:41


Author: viboes
Date: 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
New Revision: 68675
URL: http://svn.boost.org/trac/boost/changeset/68675

Log:
Stopwatches: Adapt to changes of Chrono in trunk
Text files modified:
   sandbox/chrono/libs/stopwatches/example/scoped_stopwatch_example.cpp | 3 ++-
   sandbox/chrono/libs/stopwatches/example/sleep_for.hpp | 2 +-
   sandbox/chrono/libs/stopwatches/example/specific_stopwatch_accumulator_example.cpp | 2 +-
   sandbox/chrono/libs/stopwatches/example/stopwatch_example.cpp | 1 +
   sandbox/chrono/libs/stopwatches/test/Jamfile.v2 | 21 +++++++++++----------
   sandbox/chrono/libs/stopwatches/test/stopclock_constructor_overload_test.cpp | 10 +++++-----
   sandbox/chrono/libs/stopwatches/test/wstopclock_constructor_overload_test.cpp | 11 ++++++-----
   7 files changed, 27 insertions(+), 23 deletions(-)

Modified: sandbox/chrono/libs/stopwatches/example/scoped_stopwatch_example.cpp
==============================================================================
--- sandbox/chrono/libs/stopwatches/example/scoped_stopwatch_example.cpp (original)
+++ sandbox/chrono/libs/stopwatches/example/scoped_stopwatch_example.cpp 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -29,8 +29,9 @@
   stopwatch_reporter<stopwatch<> > _(BOOST_STOPWATCHES_STOPWATCH_FUNCTION_FORMAT);
 
     res=0;
- for (long i =0; i< 3; ++i)
+ for (long i =0; i< 3; ++i) {
         f1(i*100);
+ }
 
     std::cout<< res << std::endl;
   return 0;

Modified: sandbox/chrono/libs/stopwatches/example/sleep_for.hpp
==============================================================================
--- sandbox/chrono/libs/stopwatches/example/sleep_for.hpp (original)
+++ sandbox/chrono/libs/stopwatches/example/sleep_for.hpp 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -11,7 +11,7 @@
 void sleep_for(const boost::chrono::duration<Rep, Period>& d)
 {
     boost::chrono::high_resolution_clock::time_point go = boost::chrono::high_resolution_clock::now() + d;
- while (boost::chrono::high_resolution_clock::now() < go);
+ while (boost::chrono::high_resolution_clock::now() < go) {}
 }
 }
 }

Modified: sandbox/chrono/libs/stopwatches/example/specific_stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/stopwatches/example/specific_stopwatch_accumulator_example.cpp (original)
+++ sandbox/chrono/libs/stopwatches/example/specific_stopwatch_accumulator_example.cpp 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -29,7 +29,7 @@
         static void show_time( Stopwatch & stopwatch_, const char_type* format,
                                 int places, ostream_type & os, boost::system::error_code & ec)
         {
- if (&ec != &boost::system::throws) ec.clear();
+ if (&ec != &BOOST_CHRONO_THROWS) ec.clear();
             typedef typename Stopwatch::storage_type accumulator_t;
             typedef typename Stopwatch::duration duration_t;
             accumulator_t& acc = stopwatch_.get_storage();

Modified: sandbox/chrono/libs/stopwatches/example/stopwatch_example.cpp
==============================================================================
--- sandbox/chrono/libs/stopwatches/example/stopwatch_example.cpp (original)
+++ sandbox/chrono/libs/stopwatches/example/stopwatch_example.cpp 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -8,6 +8,7 @@
 
 // See http://www.boost.org/libs/chrono for documentation.
 
+#include <iostream>
 #include <boost/stopwatches/stopwatches.hpp>
 #include <cmath>
 

Modified: sandbox/chrono/libs/stopwatches/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/stopwatches/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/stopwatches/test/Jamfile.v2 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -28,6 +28,7 @@
         #<include>../../..
         <toolset>msvc:<asynch-exceptions>on
         <define>BOOST_ENABLE_WARNINGS
+ <define>BOOST_CHRONO_EXTENSIONS
         <warnings>all
         <toolset>gcc:<cxxflags>-Wextra
         <toolset>gcc:<cxxflags>-Wno-long-long
@@ -43,12 +44,18 @@
 
     test-suite "other_clocks"
         :
- [ run test_suspendible_clock.cpp : : : <library>/boost/thread//boost_thread <link>static ]
- [ run test_suspendible_clock.cpp : : : <library>/boost/thread//boost_thread : test_suspendible_clock_dll ]
+ #[ run test_suspendible_clock.cpp : : : <library>/boost/thread//boost_thread <link>static ]
+ #[ run test_suspendible_clock.cpp : : : <library>/boost/thread//boost_thread : test_suspendible_clock_dll ]
         ;
 
     test-suite "stopwatch"
         :
+ [ run stopclock_constructor_overload_test.cpp : : : <link>static ]
+ [ run stopclock_constructor_overload_test.cpp : : : : stopclock_constructor_overload_test_dll ]
+ [ run wstopclock_constructor_overload_test.cpp : : : <link>static ]
+ [ run wstopclock_constructor_overload_test.cpp : : : : wstopclock_constructor_overload_test_dll ]
+ [ run ../example/scoped_stopclock_example.cpp : : : <link>static ]
+ [ run ../example/scoped_stopclock_example.cpp : : : : function_stopclock_example_dll ]
         [ run ../example/stopwatch_example.cpp : : : <link>static ]
         [ run ../example/stopwatch_example.cpp : : : : stopwatch_example_dll ]
         [ run ../example/scoped_stopwatch_example.cpp : : : <link>static ]
@@ -67,20 +74,14 @@
         [ run ../example/loop_stopclock_accumulator_example.cpp : : : : loop_stopclock_accumulator_example_dll ]
         [ run ../example/t24_hours_example.cpp : : : <link>static ]
         [ run ../example/t24_hours_example.cpp : : : : t24_hours_example_dll ]
- [ run ../example/scoped_stopclock_example.cpp : : : <link>static ]
- [ run ../example/scoped_stopclock_example.cpp : : : : function_stopclock_example_dll ]
         [ link ../example/timex.cpp : <link>static ]
         [ link ../example/timex.cpp : : timex_dll ]
- [ run stopclock_constructor_overload_test.cpp : : : <link>static ]
- [ run stopclock_constructor_overload_test.cpp : : : : stopclock_constructor_overload_test_dll ]
- [ run wstopclock_constructor_overload_test.cpp : : : <link>static ]
- [ run wstopclock_constructor_overload_test.cpp : : : : wstopclock_constructor_overload_test_dll ]
         ;
         
     test-suite "perf"
         :
- [ run ../example/suspendible_stopclock_example.cpp : : : <library>/boost/thread//boost_thread <link>static ]
- [ run ../example/suspendible_stopclock_example.cpp : : : <library>/boost/thread//boost_thread : suspendible_stopclock_example_dll ]
+ #[ run ../example/suspendible_stopclock_example.cpp : : : <library>/boost/thread//boost_thread <link>static ]
+ #[ run ../example/suspendible_stopclock_example.cpp : : : <library>/boost/thread//boost_thread : suspendible_stopclock_example_dll ]
         #[ run ../perf/stopclock_perf.cpp : : : <library>/boost/thread//boost_thread <link>static ]
         #[ run ../perf/stopclock_perf.cpp : : : <library>/boost/thread//boost_thread : stopclock_perf_dll ]
         ;

Modified: sandbox/chrono/libs/stopwatches/test/stopclock_constructor_overload_test.cpp
==============================================================================
--- sandbox/chrono/libs/stopwatches/test/stopclock_constructor_overload_test.cpp (original)
+++ sandbox/chrono/libs/stopwatches/test/stopclock_constructor_overload_test.cpp 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -20,7 +20,7 @@
 using boost::stopwatches::time_formatter;
 using boost::system::error_code;
 
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
 
 namespace
 {
@@ -64,13 +64,13 @@
 
 }
 
-int test_main( int /*argc*/, char * /*argv*/[] )
+int main( )
 {
- std::locale loc( "" ); // test with appropriate locale
- std::cout.imbue( loc );
+ //~ std::locale loc( "" ); // test with appropriate locale
+ //~ std::cout.imbue( loc );
 
   stopclock_constructor_overload_test();
   
- return 0;
+ return boost::report_errors();
 }
 

Modified: sandbox/chrono/libs/stopwatches/test/wstopclock_constructor_overload_test.cpp
==============================================================================
--- sandbox/chrono/libs/stopwatches/test/wstopclock_constructor_overload_test.cpp (original)
+++ sandbox/chrono/libs/stopwatches/test/wstopclock_constructor_overload_test.cpp 2011-02-06 12:21:38 EST (Sun, 06 Feb 2011)
@@ -29,7 +29,8 @@
 using boost::stopwatches::time_formatter;
 using boost::system::error_code;
 using boost::stopwatches::detail::adaptive_string;
-#include <boost/test/minimal.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
 
 
 namespace util
@@ -123,15 +124,15 @@
> wstopclock_t;
 }
 
-int test_main( int /*argc*/, char * /*argv*/[] )
+int main( )
 {
- std::locale loc( "" ); // test with appropriate locale
- std::cout.imbue( loc );
+ //~ std::locale loc( "" ); // test with appropriate locale
+ //~ std::cout.imbue( loc );
    
   stopclock_constructor_overload_test<stopclock_t>(); // test for char
 #ifndef BOOST_NO_STD_WSTRING
   stopclock_constructor_overload_test<wstopclock_t>(); // test for wchar_t
 #endif
- return 0;
+ return boost::report_errors();
 }
 


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