Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80424 - in branches/release: boost/chrono boost/chrono/detail boost/chrono/io boost/chrono/io/utility boost/chrono/io_v1 libs/chrono/example libs/chrono/perf libs/chrono/src libs/chrono/test libs/chrono/test/duration libs/chrono/test/io libs/chrono/test/time_point libs/chrono/test/traits
From: vicente.botet_at_[hidden]
Date: 2012-09-06 16:12:57


Author: viboes
Date: 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
New Revision: 80424
URL: http://svn.boost.org/trac/boost/changeset/80424

Log:
Chrono: merged from trunk chrono io V2
Added:
   branches/release/boost/chrono/io/ (props changed)
   branches/release/boost/chrono/io/duration_get.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/duration_get.hpp
   branches/release/boost/chrono/io/duration_put.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/duration_put.hpp
   branches/release/boost/chrono/io/duration_style.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/duration_style.hpp
   branches/release/boost/chrono/io/duration_units.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/duration_units.hpp
   branches/release/boost/chrono/io/ios_base_state.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/ios_base_state.hpp
   branches/release/boost/chrono/io/time_point_get.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/time_point_get.hpp
   branches/release/boost/chrono/io/time_point_put.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/time_point_put.hpp
   branches/release/boost/chrono/io/time_point_units.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/time_point_units.hpp
   branches/release/boost/chrono/io/timezone.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/timezone.hpp
   branches/release/boost/chrono/io/utility/
      - copied from r80241, /trunk/boost/chrono/io/utility/
   branches/release/boost/chrono/io/utility/ios_base_state_ptr.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/utility/ios_base_state_ptr.hpp
   branches/release/boost/chrono/io/utility/manip_base.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/utility/manip_base.hpp
   branches/release/boost/chrono/io/utility/to_string.hpp
      - copied unchanged from r80241, /trunk/boost/chrono/io/utility/to_string.hpp
Properties modified:
   branches/release/boost/chrono/detail/ (props changed)
   branches/release/boost/chrono/io_v1/ (props changed)
   branches/release/libs/chrono/src/ (props changed)
   branches/release/libs/chrono/test/duration/ (props changed)
   branches/release/libs/chrono/test/io/ (props changed)
   branches/release/libs/chrono/test/time_point/ (props changed)
   branches/release/libs/chrono/test/traits/ (props changed)
Text files modified:
   branches/release/boost/chrono/chrono_io.hpp | 7
   branches/release/boost/chrono/config.hpp | 5
   branches/release/boost/chrono/detail/static_assert.hpp | 2
   branches/release/boost/chrono/duration.hpp | 16
   branches/release/boost/chrono/io_v1/chrono_io.hpp | 74 ++--
   branches/release/libs/chrono/example/chrono_accuracy_test.cpp | 28 +-
   branches/release/libs/chrono/example/french.cpp | 96 +++++++
   branches/release/libs/chrono/example/io_ex1.cpp | 24 +
   branches/release/libs/chrono/perf/Jamfile.v2 | 1
   branches/release/libs/chrono/test/Jamfile.v2 | 279 ++++++++++++++------
   branches/release/libs/chrono/test/duration/arithmetic_pass.cpp | 521 ++++++++++++++++++++++++---------------
   branches/release/libs/chrono/test/duration/comparisons_pass.cpp | 263 +++++++++++++------
   branches/release/libs/chrono/test/duration/constructor_pass.cpp | 70 ++++
   branches/release/libs/chrono/test/duration/duration_cast_pass.cpp | 12
   branches/release/libs/chrono/test/duration/duration_values_pass.cpp | 25 +
   branches/release/libs/chrono/test/io/duration_input.cpp | 28 ++
   branches/release/libs/chrono/test/io/duration_output.cpp | 12
   branches/release/libs/chrono/test/io/time_point_input.cpp | 2
   branches/release/libs/chrono/test/io/time_point_output.cpp | 10
   branches/release/libs/chrono/test/rep.h | 16
   branches/release/libs/chrono/test/time_point/arithmetic_ext_pass.cpp | 40 --
   branches/release/libs/chrono/test/time_point/arithmetic_pass.cpp | 124 +++++---
   branches/release/libs/chrono/test/time_point/comparisons_pass.cpp | 187 +++++++++----
   branches/release/libs/chrono/test/time_point/constructor_pass.cpp | 89 ++++--
   branches/release/libs/chrono/test/time_point/min_max_pass.cpp | 13
   branches/release/libs/chrono/test/time_point/time_point_cast_pass.cpp | 17 +
   branches/release/libs/chrono/test/traits/duration_values_pass.cpp | 4
   27 files changed, 1323 insertions(+), 642 deletions(-)

Modified: branches/release/boost/chrono/chrono_io.hpp
==============================================================================
--- branches/release/boost/chrono/chrono_io.hpp (original)
+++ branches/release/boost/chrono/chrono_io.hpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -14,6 +14,13 @@
 #define BOOST_CHRONO_CHRONO_IO_HPP
 
 #include <boost/chrono/config.hpp>
+#if BOOST_CHRONO_VERSION == 2
+#include <boost/chrono/io/time_point_io.hpp>
+#include <boost/chrono/io/duration_io.hpp>
+#elif BOOST_CHRONO_VERSION == 1
 #include <boost/chrono/io_v1/chrono_io.hpp>
+#endif
+
+#include <boost/chrono/io/utility/to_string.hpp>
 
 #endif // BOOST_CHRONO_CHRONO_IO_HPP

Modified: branches/release/boost/chrono/config.hpp
==============================================================================
--- branches/release/boost/chrono/config.hpp (original)
+++ branches/release/boost/chrono/config.hpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -100,14 +100,14 @@
 
 // unicode support ------------------------------//
 
-#if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T)
+#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T)
 //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT
 #else
 #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1
 #endif
 
 #if ! defined BOOST_NOEXCEPT
-#if defined(BOOST_NO_NOEXCEPT)
+#if defined(BOOST_NO_CXX11_NOEXCEPT)
 #define BOOST_NOEXCEPT
 #else
 #define BOOST_NOEXCEPT noexcept
@@ -166,3 +166,4 @@
 #endif // auto-linking disabled
 #endif // BOOST_CHRONO_HEADER_ONLY
 #endif // BOOST_CHRONO_CONFIG_HPP
+

Modified: branches/release/boost/chrono/detail/static_assert.hpp
==============================================================================
--- branches/release/boost/chrono/detail/static_assert.hpp (original)
+++ branches/release/boost/chrono/detail/static_assert.hpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -11,7 +11,7 @@
 
 #include <boost/chrono/config.hpp>
 
-#ifndef BOOST_NO_STATIC_ASSERT
+#ifndef BOOST_NO_CXX11_STATIC_ASSERT
 #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
 #elif defined(BOOST_CHRONO_USES_STATIC_ASSERT)
 #include <boost/static_assert.hpp>

Modified: branches/release/boost/chrono/duration.hpp
==============================================================================
--- branches/release/boost/chrono/duration.hpp (original)
+++ branches/release/boost/chrono/duration.hpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -51,7 +51,7 @@
 #include <boost/detail/workaround.hpp>
 #include <boost/integer_traits.hpp>
 
-#if !defined(BOOST_NO_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT)
+#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT)
 #define BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION "A duration representation can not be a duration"
 #define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO "Second template parameter of duration must be a boost::ratio"
 #define BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE "duration period must be positive"
@@ -340,17 +340,17 @@
 namespace detail {
     template <class T, bool = is_arithmetic<T>::value>
     struct chrono_numeric_limits {
- static T lowest() throw() {return (std::numeric_limits<T>::min) ();}
+ static BOOST_CONSTEXPR T lowest() throw() {return (std::numeric_limits<T>::min) ();}
     };
 
     template <class T>
     struct chrono_numeric_limits<T,true> {
- static T lowest() throw() {return (std::numeric_limits<T>::min) ();}
+ static BOOST_CONSTEXPR T lowest() throw() {return (std::numeric_limits<T>::min) ();}
     };
 
     template <>
     struct chrono_numeric_limits<float,true> {
- static float lowest() throw()
+ static BOOST_CONSTEXPR float lowest() throw()
         {
             return -(std::numeric_limits<float>::max) ();
         }
@@ -358,7 +358,7 @@
 
     template <>
     struct chrono_numeric_limits<double,true> {
- static double lowest() throw()
+ static BOOST_CONSTEXPR double lowest() throw()
         {
             return -(std::numeric_limits<double>::max) ();
         }
@@ -366,7 +366,7 @@
 
     template <>
     struct chrono_numeric_limits<long double,true> {
- static long double lowest() throw()
+ static BOOST_CONSTEXPR long double lowest() throw()
         {
             return -(std::numeric_limits<long double>::max)();
         }
@@ -484,7 +484,7 @@
         // arithmetic
 
         BOOST_CONSTEXPR
- duration operator+() const {return *this;}
+ duration operator+() const {return duration(rep_);;}
         BOOST_CONSTEXPR
         duration operator-() const {return duration(-rep_);}
         duration& operator++() {++rep_; return *this;}
@@ -761,7 +761,7 @@
     // Duration >=
 
     template <class Rep1, class Period1, class Rep2, class Period2>
- inline
+ inline BOOST_CONSTEXPR
     bool
     operator>=(const duration<Rep1, Period1>& lhs,
           const duration<Rep2, Period2>& rhs)

Modified: branches/release/boost/chrono/io_v1/chrono_io.hpp
==============================================================================
--- branches/release/boost/chrono/io_v1/chrono_io.hpp (original)
+++ branches/release/boost/chrono/io_v1/chrono_io.hpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -265,59 +265,59 @@
 std::basic_istream<CharT, Traits>&
 operator>>(std::basic_istream<CharT, Traits>& is, duration<Rep, Period>& d)
 {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     typedef duration_punct<CharT> Facet;
     std::locale loc = is.getloc();
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     if (!std::has_facet<Facet>(loc)) {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         is.imbue(std::locale(loc, new Facet));
     }
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     loc = is.getloc();
     const Facet& f = std::use_facet<Facet>(loc);
     typedef typename chrono_detail::duration_io_intermediate<Rep>::type intermediate_type;
     intermediate_type r;
     std::ios_base::iostate err = std::ios_base::goodbit;
     // read value into r
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     is >> r;
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     if (is.good())
     {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         // now determine unit
         typedef std::istreambuf_iterator<CharT, Traits> in_iterator;
         in_iterator i(is);
         in_iterator e;
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         if (i != e && *i == ' ') // mandatory ' ' after value
         {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             ++i;
             if (i != e)
             {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // unit is num / den (yet to be determined)
                 unsigned long long num = 0;
                 unsigned long long den = 0;
                 if (*i == '[')
                 {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // parse [N/D]s or [N/D]seconds format
                     ++i;
                     CharT x;
                     is >> num >> x >> den;
                     if (!is.good() || (x != '/'))
                     {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         is.setstate(is.failbit);
                         return is;
                     }
                     i = in_iterator(is);
                     if (*i != ']')
                     {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         is.setstate(is.failbit);
                         return is;
                     }
@@ -328,27 +328,27 @@
                         f.template plural<ratio<1> >(),
                         f.template short_name<ratio<1> >()
                     };
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     const std::basic_string<CharT>* k = chrono_detail::scan_keyword(i, e,
                                   units, units + sizeof(units)/sizeof(units[0]),
                                   //~ std::use_facet<std::ctype<CharT> >(loc),
                                   err);
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     is.setstate(err);
                     switch ((k - units) / 3)
                     {
                     case 0:
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         break;
                     default:
                         is.setstate(err);
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         return is;
                     }
                 }
                 else
                 {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // parse SI name, short or long
                     const std::basic_string<CharT> units[] =
                     {
@@ -410,12 +410,12 @@
                         f.template plural<ratio<3600> >(),
                         f.template short_name<ratio<3600> >()
                     };
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     const std::basic_string<CharT>* k = chrono_detail::scan_keyword(i, e,
                                   units, units + sizeof(units)/sizeof(units[0]),
                                   //~ std::use_facet<std::ctype<CharT> >(loc),
                                   err);
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     switch ((k - units) / 3)
                     {
                     case 0:
@@ -495,12 +495,12 @@
                         den = 1;
                         break;
                     default:
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         is.setstate(err|is.failbit);
                         return is;
                     }
                 }
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // unit is num/den
                 // r should be multiplied by (num/den) / Period
                 // Reduce (num/den) / Period to lowest terms
@@ -513,7 +513,7 @@
                 if (num > (std::numeric_limits<unsigned long long>::max)() / d2 ||
                     den > (std::numeric_limits<unsigned long long>::max)() / n2)
                 {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // (num/den) / Period overflows
                     is.setstate(err|is.failbit);
                     return is;
@@ -523,68 +523,68 @@
 
                 typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
 
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // num / den is now factor to multiply by r
                 if (!chrono_detail::reduce(r, den, err))
                 {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                   is.setstate(err|is.failbit);
                   return is;
                 }
 
                 //if (r > ((duration_values<common_type_t>::max)() / num))
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 if (chrono::detail::gt(r,((duration_values<common_type_t>::max)() / num)))
                 {
                     // Conversion to Period overflowed
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     is.setstate(err|is.failbit);
                     return is;
                 }
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 common_type_t t = r * num;
                 t /= den;
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
 
                 if (t > 0)
                 {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                   Rep pt = t;
                   if ( (duration_values<Rep>::max)() < pt)
                   {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // Conversion to Period overflowed
                     is.setstate(err|is.failbit);
                     return is;
                   }
                 }
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // Success! Store it.
                 r = Rep(t);
                 d = duration<Rep, Period>(r);
                 is.setstate(err);
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 return is;
             }
             else {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 is.setstate(is.failbit | is.eofbit);
                 return is;
             }
         }
         else
         {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             if (i == e)
               is.setstate(is.failbit|is.eofbit);
             else
               is.setstate(is.failbit);
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             return is;
         }
     }
     else {
- std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ //std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         //is.setstate(is.failbit);
       return is;
     }

Modified: branches/release/libs/chrono/example/chrono_accuracy_test.cpp
==============================================================================
--- branches/release/libs/chrono/example/chrono_accuracy_test.cpp (original)
+++ branches/release/libs/chrono/example/chrono_accuracy_test.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -11,7 +11,7 @@
 #include <boost/chrono/chrono.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
 #include <boost/chrono/thread_clock.hpp>
-#include <libs/chrono/example/timer.hpp>
+#include "boost/chrono/stopwatches/simple_stopwatch.hpp"
 #include <cstdlib> // for atol()
 #include <iostream>
 #include <sstream>
@@ -40,12 +40,12 @@
     timeout_in_clock_t += (timeout_in_secs * CLOCKS_PER_SEC);
     std::cout << "accuracy test. Timeout=" << timeout_in_clock_t << " ticks...";
 
- boost::chrono::system_timer sys;
+ boost::chrono::simple_stopwatch<boost::chrono::system_clock> sys;
 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- boost::chrono::steady_timer mono;
+ boost::chrono::simple_stopwatch<boost::chrono::steady_clock> steady;
 #endif
- boost::chrono::high_resolution_timer hires;
- boost::chrono::timer<boost::chrono::process_cpu_clock> process;
+ boost::chrono::simple_stopwatch<> hires;
+ boost::chrono::simple_stopwatch<boost::chrono::process_cpu_clock> process;
 
     std::clock_t now;
     do
@@ -53,12 +53,12 @@
       now = std::clock();
     } while ( now < timeout_in_clock_t );
 
- boost::chrono::system_timer::duration sys_dur = sys.elapsed();
+ boost::chrono::simple_stopwatch<boost::chrono::system_clock>::duration sys_dur = sys.elapsed();
 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- boost::chrono::steady_timer::duration mono_dur = mono.elapsed();
+ boost::chrono::simple_stopwatch<boost::chrono::steady_clock>::duration steady_dur = steady.elapsed();
 #endif
- boost::chrono::high_resolution_timer::duration hires_dur = hires.elapsed();
- boost::chrono::process_cpu_clock::duration times;
+ boost::chrono::simple_stopwatch<>::duration hires_dur = hires.elapsed();
+ boost::chrono::simple_stopwatch<boost::chrono::process_cpu_clock>::duration times;
     times = process.elapsed();
     std::cout << "accuracy test. Now=" << now << " ticks...";
 
@@ -79,10 +79,10 @@
       && sys_dur < timeout_in_nanoseconds + maximum_delta );
 
 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- std::cout << mono_dur.count() << " mono_dur\n";
+ std::cout << steady_dur.count() << " steady_dur\n";
 
- BOOST_TEST( mono_dur > timeout_in_nanoseconds - maximum_delta
- && mono_dur < timeout_in_nanoseconds + maximum_delta );
+ BOOST_TEST( steady_dur > timeout_in_nanoseconds - maximum_delta
+ && steady_dur < timeout_in_nanoseconds + maximum_delta );
 #endif
 
     std::cout << hires_dur.count() << " hires_dur\n";
@@ -92,8 +92,8 @@
 
     std::cout << times.count().real << " times.real\n";
 
-// BOOST_TEST( times.count().real > timeout_in_nanoseconds - maximum_delta
-// && times.count().real < timeout_in_nanoseconds + maximum_delta );
+ BOOST_TEST( ns(times.count().real) > timeout_in_nanoseconds - maximum_delta
+ && ns(times.count().real) < timeout_in_nanoseconds + maximum_delta );
   }
 
 }

Modified: branches/release/libs/chrono/example/french.cpp
==============================================================================
--- branches/release/libs/chrono/example/french.cpp (original)
+++ branches/release/libs/chrono/example/french.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -7,12 +7,102 @@
 
 // Adapted to Boost from the original Hawards's code
 
+
+#include <boost/chrono/config.hpp>
 #include <boost/chrono/chrono_io.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
 #include <boost/chrono/thread_clock.hpp>
 #include <iostream>
 #include <locale>
 
+
+#if BOOST_CHRONO_VERSION==2
+#include <boost/chrono/io/duration_units.hpp>
+
+ using namespace boost;
+ using namespace boost::chrono;
+
+ template <typename CharT=char>
+ class duration_units_fr: public duration_units_default<CharT>
+ {
+ public:
+ typedef CharT char_type;
+
+ explicit duration_units_fr(size_t refs = 0) :
+ duration_units_default<CharT>(refs)
+ {
+ }
+ protected:
+
+ using duration_units_default<CharT>::do_get_unit;
+ std::size_t do_get_plural_form(boost::int_least64_t value) const
+ {
+ return (value == -1 || value == 0 || value == 1) ? 0 : 1;
+ }
+
+ std::basic_string<CharT> do_get_unit(duration_style style, ratio<1> , std::size_t pf) const
+ {
+ static const CharT t[] =
+ { 's' };
+ static const std::basic_string<CharT> symbol(t, t + sizeof (t) / sizeof (t[0]));
+ static const CharT u[] =
+ { 's', 'e', 'c', 'o', 'n', 'd', 'e' };
+ static const std::basic_string<CharT> singular(u, u + sizeof (u) / sizeof (u[0]));
+ static const CharT v[] =
+ { 's', 'e', 'c', 'o', 'n', 'd', 'e', 's' };
+ static const std::basic_string<CharT> plural(v, v + sizeof (v) / sizeof (v[0]));
+
+ if (style == duration_style::symbol) return symbol;
+ if (pf == 0) return singular;
+ if (pf == 1) return plural;
+ // assert
+ //throw "exception";
+ return "";
+ }
+
+ std::basic_string<CharT> do_get_unit(duration_style style, ratio<60> , std::size_t pf) const
+ {
+ static const CharT t[] =
+ { 'm', 'i', 'n' };
+ static const std::basic_string<CharT> symbol(t, t + sizeof (t) / sizeof (t[0]));
+
+ static const CharT u[] =
+ { 'm', 'i', 'n', 'u', 't', 'e' };
+ static const std::basic_string<CharT> singular(u, u + sizeof (u) / sizeof (u[0]));
+ static const CharT v[] =
+ { 'm', 'i', 'n', 'u', 't', 'e', 's' };
+ static const std::basic_string<CharT> plural(v, v + sizeof (v) / sizeof (v[0]));
+
+ if (style == duration_style::symbol) return symbol;
+ if (pf == 0) return singular;
+ if (pf == 1) return plural;
+ // assert
+ //throw "exception";
+ return "";
+ }
+
+ std::basic_string<CharT> do_get_unit(duration_style style, ratio<3600> , std::size_t pf) const
+ {
+ static const CharT t[] =
+ { 'h' };
+ static const std::basic_string<CharT> symbol(t, t + sizeof (t) / sizeof (t[0]));
+ static const CharT u[] =
+ { 'h', 'e', 'u', 'r', 'e' };
+ static const std::basic_string<CharT> singular(u, u + sizeof (u) / sizeof (u[0]));
+ static const CharT v[] =
+ { 'h', 'e', 'u', 'r', 'e', 's' };
+ static const std::basic_string<CharT> plural(v, v + sizeof (v) / sizeof (v[0]));
+
+ if (style == duration_style::symbol) return symbol;
+ if (pf == 0) return singular;
+ if (pf == 1) return plural;
+ // assert
+ //throw "exception";
+ return "";
+ }
+ };
+#endif
+
 int main()
 {
     using std::cout;
@@ -20,15 +110,21 @@
     using namespace boost;
     using namespace boost::chrono;
 
+#if BOOST_CHRONO_VERSION==2
+ cout.imbue(locale(locale(), new duration_units_fr<>()));
+#else
     cout.imbue(locale(locale(), new duration_punct<char>
         (
             duration_punct<char>::use_long,
             "secondes", "minutes", "heures",
             "s", "m", "h"
         )));
+#endif
     hours h(5);
     minutes m(45);
     seconds s(15);
     milliseconds ms(763);
     cout << h << ", " << m << ", " << s << " et " << ms << '\n';
+ cout << hours(0) << ", " << minutes(0) << ", " << s << " et " << ms << '\n';
+ return 0;
 }

Modified: branches/release/libs/chrono/example/io_ex1.cpp
==============================================================================
--- branches/release/libs/chrono/example/io_ex1.cpp (original)
+++ branches/release/libs/chrono/example/io_ex1.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -13,8 +13,11 @@
 */
 
 #include <iostream>
+#include <boost/chrono/config.hpp>
 #include <boost/chrono/chrono_io.hpp>
+#include <boost/chrono/system_clocks.hpp>
 #include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
 
 int main()
 {
@@ -22,6 +25,8 @@
     using namespace boost;
     using namespace boost::chrono;
 
+ cout << "milliseconds(1) = "
+ << milliseconds(1) << '\n';
     cout << "milliseconds(3) + microseconds(10) = "
          << milliseconds(3) + microseconds(10) << '\n';
 
@@ -33,8 +38,11 @@
          << ClockTick(3) + nanoseconds(10) << '\n';
 
     cout << "\nSet cout to use short names:\n";
+#if BOOST_CHRONO_VERSION==2
+ cout << duration_fmt(duration_style::symbol);
+#else
     cout << duration_short;
-
+#endif
     cout << "milliseconds(3) + microseconds(10) = "
          << milliseconds(3) + microseconds(10) << '\n';
 
@@ -45,17 +53,29 @@
          << ClockTick(3) + nanoseconds(10) << '\n';
 
     cout << "\nsystem_clock::now() = " << system_clock::now() << '\n';
+#if BOOST_CHRONO_VERSION==2
+ cout << "\nsystem_clock::now() = " << time_fmt(chrono::timezone::local) << system_clock::now() << '\n';
+ cout << "\nsystem_clock::now() = " << time_fmt(chrono::timezone::local,"%Y/%m/%d") << system_clock::now() << '\n';
+#endif
+
 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
     cout << "steady_clock::now() = " << steady_clock::now() << '\n';
 #endif
- cout << "\nSet cout to use long names:\n" << duration_long
+#if BOOST_CHRONO_VERSION==2
+ cout << "\nSet cout to use long names:\n" << duration_fmt(duration_style::prefix)
          << "high_resolution_clock::now() = " << high_resolution_clock::now() << '\n';
+#else
+ cout << "\nSet cout to use long names:\n" << duration_long
+ << "high_resolution_clock::now() = " << high_resolution_clock::now() << '\n';
+#endif
 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
     cout << "\nthread_clock::now() = " << thread_clock::now() << '\n';
 #endif
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
     cout << "\nprocess_real_cpu_clock::now() = " << process_real_cpu_clock::now() << '\n';
     cout << "\nprocess_user_cpu_clock::now() = " << process_user_cpu_clock::now() << '\n';
     cout << "\nprocess_system_cpu_clock::now() = " << process_system_cpu_clock::now() << '\n';
     cout << "\nprocess_cpu_clock::now() = " << process_cpu_clock::now() << '\n';
+#endif
     return 0;
 }

Modified: branches/release/libs/chrono/perf/Jamfile.v2
==============================================================================
--- branches/release/libs/chrono/perf/Jamfile.v2 (original)
+++ branches/release/libs/chrono/perf/Jamfile.v2 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -42,6 +42,7 @@
 # remark #383: value copied to temporary, reference to temporary used
 # remark #1418: external function definition with no prior declaration
         <toolset>intel:<cxxflags>-wd304,383,1418
+ <define>BOOST_CHRONO_VERSION=2
     ;
 
 rule chrono-run ( sources )

Modified: branches/release/libs/chrono/test/Jamfile.v2
==============================================================================
--- branches/release/libs/chrono/test/Jamfile.v2 (original)
+++ branches/release/libs/chrono/test/Jamfile.v2 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -54,20 +54,54 @@
         : :
         :
             <library>/boost/system//boost_system
- : $(sources[1]:B)_shared ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
     #[ run $(sources) ../build//boost_chrono/<link>static
     # : :
     # :
- # <library>/boost/system//boost_system
- # : $(sources[1]:B)_static ]
+ # <library>/boost/system//boost_system/<link>static
+ # : $(sources[1]:B)_s ]
     [ run $(sources)
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(sources[1]:B)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
     ;
 }
+
+rule chrono-v1-v2-run ( sources )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <library>/boost/system//boost_system
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ [ run $(sources) ../build//boost_chrono/<link>static
+ : :
+ :
+ <library>/boost/system//boost_system/<link>static
+ : v1_$(sources[1]:B)_s ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : v1_$(sources[1]:B)_h ]
+ ;
+}
+
 rule chrono-run2 ( sources : name )
 {
     return
@@ -75,18 +109,82 @@
         : :
         :
             <library>/boost/system//boost_system
- : $(name)_shared ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
     #[ run $(sources) ../build//boost_chrono/<link>static
     # : :
     # :
- # <library>/boost/system//boost_system
- # : $(name)_static ]
+ # <library>/boost/system//boost_system/<link>static
+ # : $(name)_s ]
     [ run $(sources)
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(name)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule stopwatch-run ( sources + )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <library>/boost/system//boost_system
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule stopwatch-run2 ( sources + : name )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <library>/boost/system//boost_system
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
+ ;
+}
+
+rule date-run ( sources + )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <library>/boost/system//boost_system
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
+ ;
+}
+
+rule date-run-2 ( sources + : name )
+{
+ return
+ [ run $(sources) ../build//boost_chrono
+ : :
+ :
+ <library>/boost/system//boost_system
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
     ;
 }
 
@@ -98,18 +196,20 @@
         : :
         :
             <library>/boost/system//boost_system
- : $(sources[1]:B)_shared ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
     #[ run $(sources) ../build//boost_chrono/<link>static
     # : :
     # :
- # <library>/boost/system//boost_system
- # : $(sources[1]:B)_static ]
+ # <library>/boost/system//boost_system/<link>static
+ # : $(sources[1]:B)_s ]
     [ run $(sources)
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(sources[1]:B)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
     ;
 }
 rule chrono-run2-mt ( sources : name )
@@ -119,18 +219,20 @@
         : :
         :
             <library>/boost/system//boost_system
- : $(name)_shared ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
     #[ run $(sources) ../build//boost_chrono/<link>static
     # : :
     # :
- # <library>/boost/system//boost_system
- # : $(name)_static ]
+ # <library>/boost/system//boost_system/<link>static
+ # : $(name)_s ]
     [ run $(sources)
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(name)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
     ;
 }
 
@@ -141,18 +243,21 @@
         : :
         :
             <library>/boost/system//boost_system
- : $(sources[1]:B)_shared ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_d ]
     [ run $(sources)
         : :
         :
- <library>/boost/system//boost_system
- : $(sources[1]:B)_static ]
+ <library>/boost/system//boost_system/<link>static
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_s ]
     [ run $(sources)
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(sources[1]:B)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
     ;
 }
 
@@ -163,18 +268,21 @@
         : :
         :
             <library>/boost/system//boost_system
- : $(name)_shared ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_d ]
     [ run $(sources)
         : :
         :
- <library>/boost/system//boost_system
- : $(name)_static ]
+ <library>/boost/system//boost_system/<link>static
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_s ]
     [ run $(sources)
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(name)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
     ;
 }
 
@@ -186,7 +294,27 @@
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(sources[1]:B)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ ;
+}
+
+rule chrono-v1-v2-run-header ( sources )
+{
+ return
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
+ [ run $(sources)
+ : :
+ : <define>BOOST_CHRONO_HEADER_ONLY
+ <define>BOOST_ERROR_CODE_HEADER_ONLY
+ #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ : v1_$(sources[1]:B)_h ]
     ;
 }
 
@@ -198,7 +326,8 @@
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(name)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
     ;
 }
 
@@ -207,12 +336,14 @@
     return
     [ compile $(sources)
         :
- : $(sources[1]:B)_lib ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_l ]
     [ compile $(sources)
         : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(sources[1]:B)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(sources[1]:B)_h ]
     ;
 }
 
@@ -221,12 +352,14 @@
     return
     [ compile $(sources)
         :
- : $(name)_lib ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_l ]
     [ compile $(sources)
- : <define>BOOST_CHRONO_HEADER_ONLY
+ : <define>BOOST_CHRONO_HEADER_ONLY
             <define>BOOST_ERROR_CODE_HEADER_ONLY
            #<define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : $(name)_header ]
+ <define>BOOST_CHRONO_VERSION=2
+ : $(name)_h ]
     ;
 }
 
@@ -256,10 +389,10 @@
 
     test-suite "traits"
         :
- [ chrono-compile2 traits/common_type_duration_pass.cpp : traits_common_type_duration_pass ]
- [ chrono-compile2 traits/common_type_time_point_pass.cpp : traits_common_type_time_point_pass ]
- [ chrono-compile2 traits/treat_as_floating_point_pass.cpp : traits_treat_as_floating_point_pass ]
- [ chrono-run-header2 traits/duration_values_pass.cpp : traits_duration_values_pass ]
+ [ chrono-compile2 traits/common_type_duration_pass.cpp : traits_common_type_duration_p ]
+ [ chrono-compile2 traits/common_type_time_point_pass.cpp : traits_common_type_time_point_p ]
+ [ chrono-compile2 traits/treat_as_floating_point_pass.cpp : traits_treat_as_floating_point_p ]
+ [ chrono-run-header2 traits/duration_values_pass.cpp : traits_duration_values_p ]
         ;
 
     test-suite "duration"
@@ -290,69 +423,42 @@
 
     test-suite "time_point"
         :
- [ chrono-compile2 time_point/default_duration_pass.cpp : time_point_default_duration_pass ]
- [ compile-fail time_point/not_duration_fail.cpp : : time_point_not_duration_fail ]
- [ chrono-run-header2 time_point/arithmetic_pass.cpp : time_point_arithmetic_pass ]
- [ chrono-run-header2 time_point/arithmetic_ext_pass.cpp : time_point_arithmetic_ext_pass ]
- [ chrono-run-header2 time_point/time_point_cast_pass.cpp : time_point_time_point_cast_pass ]
- [ compile-fail time_point/time_point_cast_int_fail.cpp : : time_point_time_point_cast_int_fail ]
- [ chrono-run-header2 time_point/comparisons_pass.cpp : time_point_comparisons_pass ]
- [ compile-fail time_point/comparisons/equal_fail.cpp : : time_point_equal_fail ]
- [ compile-fail time_point/comparisons/less_fail.cpp : : time_point_less_fail ]
- [ chrono-run-header2 time_point/constructor_pass.cpp : time_point_constructor_pass ]
- [ compile-fail time_point/cons/implicit_fail.cpp : : time_point_implicit_fail ]
- [ compile-fail time_point/cons/non_implicit_convertible_duration_fail.cpp : : time_point_non_implicit_convertible_duration_fail ]
- [ chrono-run-header2 time_point/min_max_pass.cpp : time_point_min_max_pass ]
+ [ chrono-compile2 time_point/default_duration_pass.cpp : time_point_default_duration_p ]
+ [ compile-fail time_point/not_duration_fail.cpp : : time_point_not_duration_f ]
+ [ chrono-run-header2 time_point/arithmetic_pass.cpp : time_point_arithmetic_p ]
+ [ chrono-run-header2 time_point/arithmetic_ext_pass.cpp : time_point_arithmetic_ext_p ]
+ [ chrono-run-header2 time_point/time_point_cast_pass.cpp : time_point_time_point_cast_p ]
+ [ compile-fail time_point/time_point_cast_int_fail.cpp : : time_point_time_point_cast_int_f ]
+ [ chrono-run-header2 time_point/comparisons_pass.cpp : time_point_comparisons_p ]
+ [ compile-fail time_point/comparisons/equal_fail.cpp : : time_point_equal_f ]
+ [ compile-fail time_point/comparisons/less_fail.cpp : : time_point_less_f ]
+ [ chrono-run-header2 time_point/constructor_pass.cpp : time_point_constructor_p ]
+ [ compile-fail time_point/cons/implicit_fail.cpp : : time_point_implicit_f ]
+ [ compile-fail time_point/cons/non_implicit_convertible_duration_fail.cpp : : time_point_non_implicit_convertible_duration_f ]
+ [ chrono-run-header2 time_point/min_max_pass.cpp : time_point_min_max_p ]
         ;
 
     test-suite "clock"
         :
- [ chrono-run2-mt clock/clock_pass.cpp : clock_clock_pass ]
+ [ chrono-run2-mt clock/clock_pass.cpp : clock_clock_p ]
         ;
 
- #test-suite "stopwatch"
- # :
- # [ chrono-run2 stopwatch/simple_stopwatch_pass.cpp : simple_stopwatch_pass ]
- # [ chrono-run2 stopwatch/basic_stopwatch_pass.cpp : basic_stopwatch_pass ]
- # [ chrono-run2 stopwatch/basic_stopwatch_last_lap_pass.cpp : basic_stopwatch_last_lap_pass ]
- # [ chrono-run2 stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp : basic_stopwatch_laps_accumulator_set_pass ]
- # [ chrono-run2 stopwatch/basic_stopwatch_laps_container_pass.cpp : basic_stopwatch_laps_container_pass ]
- # [ chrono-run2 stopwatch/suspendable_stopwatch_pass.cpp : suspendable_stopwatch_pass ]
- # ;
-
- #test-suite "stopwatch_ex"
- # :
- # [ chrono-run ../example/stopwatch_example.cpp ]
- # ;
-
- #test-suite "stopclock"
- # :
- # [ chrono-run2 stopwatch/simple_stopwatch_reporter_pass.cpp : simple_stopwatch_reporter_pass ]
- # [ chrono-run2 stopwatch/basic_stopwatch_reporter_pass.cpp : basic_stopwatch_reporter_pass ]
- # [ chrono-run2 stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp : basic_stopwatch_reporter_laps_accumulator_set_pass ]
- # ;
-
- #test-suite "stopclock_ex"
- # :
- # [ chrono-run2-mt ../example/stopwatch_reporter_example.cpp : stopwatch_reporter_example ]
- # ;
-
     test-suite "io_ex"
         :
- [ chrono-run-mt ../example/io_ex1.cpp ]
- [ chrono-run-header ../example/io_ex2.cpp ]
- [ chrono-run ../example/io_ex3.cpp ]
- [ chrono-run ../example/io_ex4.cpp ]
- [ chrono-run ../example/io_ex5.cpp ]
- [ chrono-run ../example/french.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex1.cpp ]
+ [ chrono-v1-v2-run-header ../example/io_ex2.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex3.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex4.cpp ]
+ [ chrono-v1-v2-run ../example/io_ex5.cpp ]
+ [ chrono-v1-v2-run ../example/french.cpp ]
         ;
 
     test-suite "io"
         :
- [ chrono-run-header io/duration_input.cpp ]
- [ chrono-run-header io/duration_output.cpp ]
- [ chrono-run-header io/time_point_input.cpp ]
- [ chrono-run-header io/time_point_output.cpp ]
+ [ chrono-v1-v2-run-header io/duration_input.cpp ]
+ [ chrono-v1-v2-run-header io/duration_output.cpp ]
+ [ chrono-v1-v2-run-header io/time_point_input.cpp ]
+ [ chrono-v1-v2-run-header io/time_point_output.cpp ]
         ;
 
     test-suite "win32"
@@ -360,3 +466,4 @@
         [ chrono-run win32_test.cpp ]
         ;
 
+

Modified: branches/release/libs/chrono/test/duration/arithmetic_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/duration/arithmetic_pass.cpp (original)
+++ branches/release/libs/chrono/test/duration/arithmetic_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -14,211 +14,328 @@
 #include <boost/chrono/duration.hpp>
 
 #include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 int main()
 {
 
+ // UNARY PLUS
+ {
+ boost::chrono::minutes m(3);
+ boost::chrono::minutes m2 = +m;
+ BOOST_TEST(m.count() == m2.count());
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::minutes m(3);
+ BOOST_CONSTEXPR boost::chrono::minutes m2(+m);
+ BOOST_CONSTEXPR_ASSERT(m.count() == m2.count());
+ }
+
+ // UNARY MINUS
+ {
+ boost::chrono::minutes m(3);
+ boost::chrono::minutes m2 = -m;
+ BOOST_TEST(m2.count() == -m.count());
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::minutes m(3);
+ BOOST_CONSTEXPR boost::chrono::minutes m2 = -m;
+ BOOST_CONSTEXPR_ASSERT(m2.count() == -m.count());
+ }
+ // PRE INCREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours& href = ++h;
+ BOOST_TEST(&href == &h);
+ BOOST_TEST(h.count() == 4);
+ }
+ // POST INCREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours h2 = h++;
+ BOOST_TEST(h.count() == 4);
+ BOOST_TEST(h2.count() == 3);
+ }
+ // PRE DECREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours& href = --h;
+ BOOST_TEST(&href == &h);
+ BOOST_TEST(h.count() == 2);
+ }
+ // POST DECREMENT
+ {
+ boost::chrono::hours h(3);
+ boost::chrono::hours h2 = h--;
+ BOOST_TEST(h.count() == 2);
+ BOOST_TEST(h2.count() == 3);
+ }
+ // PLUS ASSIGN
+ {
+ boost::chrono::seconds s(3);
+ s += boost::chrono::seconds(2);
+ BOOST_TEST(s.count() == 5);
+ s += boost::chrono::minutes(2);
+ BOOST_TEST(s.count() == 125);
+ }
+ // MINUS ASSIGN
+ {
+ boost::chrono::seconds s(3);
+ s -= boost::chrono::seconds(2);
+ BOOST_TEST(s.count() == 1);
+ s -= boost::chrono::minutes(2);
+ BOOST_TEST(s.count() == -119);
+ }
+ // TIMES ASSIGN
+ {
+ boost::chrono::nanoseconds ns(3);
+ ns *= 5;
+ BOOST_TEST(ns.count() == 15);
+ }
+ // DIVIDE ASSIGN
+ {
+ boost::chrono::nanoseconds ns(15);
+ ns /= 5;
+ BOOST_TEST(ns.count() == 3);
+ }
+ // MODULUS ASSIGN duration
+ {
+ boost::chrono::microseconds us(11);
+ boost::chrono::microseconds us2(3);
+ us %= us2;
+ BOOST_TEST(us.count() == 2);
+ us %= boost::chrono::milliseconds(3);
+ BOOST_TEST(us.count() == 2);
+ }
+ // MODULUS ASSIGN Rep
+ {
+ boost::chrono::microseconds us(11);
+ us %= 3;
+ BOOST_TEST(us.count() == 2);
+ }
+ // PLUS
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(5);
+ boost::chrono::seconds r = s1 + s2;
+ BOOST_TEST(r.count() == 8);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::seconds r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 8);
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::microseconds s2(5);
+ boost::chrono::microseconds r = s1 + s2;
+ BOOST_TEST(r.count() == 3000005);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::microseconds r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 3000005);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_TEST(r.count() == 75);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 75);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_TEST(r.count() == 75);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 + s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 75);
+ }
+
+ // MINUS
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(5);
+ boost::chrono::seconds r = s1 - s2;
+ BOOST_TEST(r.count() == -2);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::seconds r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == -2);
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::microseconds s2(5);
+ boost::chrono::microseconds r = s1 - s2;
+ BOOST_TEST(r.count() == 2999995);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(5);
+ BOOST_CONSTEXPR boost::chrono::microseconds r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 2999995);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_TEST(r.count() == -15);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == -15);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_TEST(r.count() == -15);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 - s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == -15);
+ }
+
+ // TIMES rep
+ {
+ boost::chrono::nanoseconds ns(3);
+ boost::chrono::nanoseconds ns2 = ns * 5;
+ BOOST_TEST(ns2.count() == 15);
+ boost::chrono::nanoseconds ns3 = 6 * ns2;
+ BOOST_TEST(ns3.count() == 90);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns(3);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns * 5;
+ BOOST_CONSTEXPR_ASSERT(ns2.count() == 15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns3 = 6 * ns2;
+ BOOST_CONSTEXPR_ASSERT(ns3.count() == 90);
+ }
+
+ // DIVIDE duration
+ {
+ boost::chrono::nanoseconds ns1(15);
+ boost::chrono::nanoseconds ns2(5);
+ BOOST_TEST(ns1 / ns2 == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(5);
+ BOOST_CONSTEXPR_ASSERT(ns1 / ns2 == 3);
+ }
+ {
+ boost::chrono::microseconds us1(15);
+ boost::chrono::nanoseconds ns2(5);
+ BOOST_TEST(us1 / ns2 == 3000);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::microseconds us1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(5);
+ BOOST_CONSTEXPR_ASSERT(us1 / ns2 == 3000);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_TEST(s1 / s2 == 6);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR_ASSERT(s1 / s2 == 6);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ BOOST_TEST(s1 / s2 == 20. / 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
+ BOOST_CONSTEXPR_ASSERT(s1 / s2 == 20. / 3);
+ }
+ // DIVIDE rep
+ {
+ boost::chrono::nanoseconds ns(15);
+ boost::chrono::nanoseconds ns2 = ns / 5;
+ BOOST_TEST(ns2.count() == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns / 5;
+ BOOST_CONSTEXPR_ASSERT(ns2.count() == 3);
+ }
+
+ // MODULUS duration
+
+ {
+ boost::chrono::nanoseconds ns1(15);
+ boost::chrono::nanoseconds ns2(6);
+ boost::chrono::nanoseconds r = ns1 % ns2;
+ BOOST_TEST(r.count() == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(6);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds r = ns1 % ns2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 3);
+ }
+ {
+ boost::chrono::microseconds us1(15);
+ boost::chrono::nanoseconds ns2(28);
+ boost::chrono::nanoseconds r = us1 % ns2;
+ BOOST_TEST(r.count() == 20);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::microseconds us1(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(28);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds r = us1 % ns2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 20);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<3, 5> > s1(6);
+ boost::chrono::duration<int, boost::ratio<2, 3> > s2(3);
+ boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 % s2;
+ BOOST_TEST(r.count() == 24);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s1(6);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s2(3);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 % s2;
+ BOOST_CONSTEXPR_ASSERT(r.count() == 24);
+ }
+ // MODULUS rep
+ {
+ boost::chrono::nanoseconds ns(15);
+ boost::chrono::nanoseconds ns2 = ns % 6;
+ BOOST_TEST(ns2.count() == 3);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns(15);
+ BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns % 6;
+ BOOST_CONSTEXPR_ASSERT(ns2.count() == 3);
+ }
 
- // UNARY PLUS
- {
- BOOST_CONSTEXPR boost::chrono::minutes m(3);
- boost::chrono::minutes m2 = +m;
- BOOST_TEST(m.count() == m2.count());
- }
-
- // UNARY MINUS
- {
- BOOST_CONSTEXPR boost::chrono::minutes m(3);
- boost::chrono::minutes m2 = -m;
- BOOST_TEST(m2.count() == -m.count());
- }
- // PRE INCREMENT
- {
- boost::chrono::hours h(3);
- boost::chrono::hours& href = ++h;
- BOOST_TEST(&href == &h);
- BOOST_TEST(h.count() == 4);
- }
- // POST INCREMENT
- {
- boost::chrono::hours h(3);
- boost::chrono::hours h2 = h++;
- BOOST_TEST(h.count() == 4);
- BOOST_TEST(h2.count() == 3);
- }
- // PRE DECREMENT
- {
- boost::chrono::hours h(3);
- boost::chrono::hours& href = --h;
- BOOST_TEST(&href == &h);
- BOOST_TEST(h.count() == 2);
- }
- // POST DECREMENT
- {
- boost::chrono::hours h(3);
- boost::chrono::hours h2 = h--;
- BOOST_TEST(h.count() == 2);
- BOOST_TEST(h2.count() == 3);
- }
- // PLUS ASSIGN
- {
- boost::chrono::seconds s(3);
- s += boost::chrono::seconds(2);
- BOOST_TEST(s.count() == 5);
- s += boost::chrono::minutes(2);
- BOOST_TEST(s.count() == 125);
- }
- // MINUS ASSIGN
- {
- boost::chrono::seconds s(3);
- s -= boost::chrono::seconds(2);
- BOOST_TEST(s.count() == 1);
- s -= boost::chrono::minutes(2);
- BOOST_TEST(s.count() == -119);
- }
- // TIMES ASSIGN
- {
- boost::chrono::nanoseconds ns(3);
- ns *= 5;
- BOOST_TEST(ns.count() == 15);
- }
- // DIVIDE ASSIGN
- {
- boost::chrono::nanoseconds ns(15);
- ns /= 5;
- BOOST_TEST(ns.count() == 3);
- }
- // MODULUS ASSIGN duration
- {
- boost::chrono::microseconds us(11);
- boost::chrono::microseconds us2(3);
- us %= us2;
- BOOST_TEST(us.count() == 2);
- us %= boost::chrono::milliseconds(3);
- BOOST_TEST(us.count() == 2);
- }
- // MODULUS ASSIGN Rep
- {
- boost::chrono::microseconds us(11);
- us %= 3;
- BOOST_TEST(us.count() == 2);
- }
- // PLUS
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::seconds s2(5);
- BOOST_CONSTEXPR boost::chrono::seconds r = s1 + s2;
- BOOST_TEST(r.count() == 8);
- }
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::microseconds s2(5);
- BOOST_CONSTEXPR boost::chrono::microseconds r = s1 + s2;
- BOOST_TEST(r.count() == 3000005);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 + s2;
- BOOST_TEST(r.count() == 75);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 + s2;
- BOOST_TEST(r.count() == 75);
- }
-
-
- // MINUS
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::seconds s2(5);
- BOOST_CONSTEXPR boost::chrono::seconds r = s1 - s2;
- BOOST_TEST(r.count() == -2);
- }
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::microseconds s2(5);
- BOOST_CONSTEXPR boost::chrono::microseconds r = s1 - s2;
- BOOST_TEST(r.count() == 2999995);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 - s2;
- BOOST_TEST(r.count() == -15);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(3);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<1, 15> > r = s1 - s2;
- BOOST_TEST(r.count() == -15);
- }
-
- // TIMES rep
- {
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns(3);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns * 5;
- BOOST_TEST(ns2.count() == 15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns3 = 6 * ns2;
- BOOST_TEST(ns3.count() == 90);
- }
-
- // DIVIDE duration
- {
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns1(15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(5);
- BOOST_TEST(ns1 / ns2 == 3);
- }
- {
- BOOST_CONSTEXPR boost::chrono::microseconds us1(15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(5);
- BOOST_TEST(us1 / ns2 == 3000);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(5);
- BOOST_TEST(s1 / s2 == 6);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(30);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(5);
- BOOST_TEST(s1 / s2 == 20./3);
- }
- // DIVIDE rep
- {
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns(15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns / 5;
- BOOST_TEST(ns2.count() == 3);
- }
-
- // MODULUS duration
-
- {
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns1(15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(6);
- BOOST_CONSTEXPR boost::chrono::nanoseconds r = ns1 % ns2;
- BOOST_TEST(r.count() == 3);
- }
- {
- BOOST_CONSTEXPR boost::chrono::microseconds us1(15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2(28);
- BOOST_CONSTEXPR boost::chrono::nanoseconds r = us1 % ns2;
- BOOST_TEST(r.count() == 20);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s1(6);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s2(3);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<1, 15> > r = s1 % s2;
- BOOST_TEST(r.count() == 24);
- }
- // MODULUS rep
- {
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns(15);
- BOOST_CONSTEXPR boost::chrono::nanoseconds ns2 = ns % 6;
- BOOST_TEST(ns2.count() == 3);
- }
-
- return boost::report_errors();
+ return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/duration/comparisons_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/duration/comparisons_pass.cpp (original)
+++ branches/release/libs/chrono/test/duration/comparisons_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -13,109 +13,210 @@
 
 #include <boost/chrono/duration.hpp>
 #include <boost/detail/lightweight_test.hpp>
-
-#define BOOST_CHRONO_TEST(C) if (true) {BOOST_CONSTEXPR bool B = (C); BOOST_TEST(B);} else
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 int main()
 {
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::seconds s2(3);
- BOOST_CONSTEXPR bool b1 = (s1 == s2);
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(3);
     BOOST_TEST(s1 == s2);
- BOOST_TEST(!(s1 != s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::seconds s2(4);
- BOOST_TEST(!(s1 == s2));
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(3);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(!(s1 != s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(4);
+ BOOST_TEST(! (s1 == s2));
     BOOST_TEST(s1 != s2);
- }
- {
- BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
- BOOST_CONSTEXPR boost::chrono::microseconds s2(3000);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(4);
+ BOOST_CONSTEXPR_ASSERT(! (s1 == s2));
+ BOOST_CONSTEXPR_ASSERT(s1 != s2);
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(3000);
     BOOST_TEST(s1 == s2);
- BOOST_TEST(!(s1 != s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
- BOOST_CONSTEXPR boost::chrono::microseconds s2(4000);
- BOOST_TEST(!(s1 == s2));
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(3000);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(! (s1 != s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(4000);
+ BOOST_TEST(! (s1 == s2));
     BOOST_TEST(s1 != s2);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(4000);
+ BOOST_CONSTEXPR_ASSERT(! (s1 == s2));
+ BOOST_CONSTEXPR_ASSERT(s1 != s2);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
     BOOST_TEST(s1 == s2);
- BOOST_TEST(!(s1 != s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
- BOOST_TEST(!(s1 == s2));
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(! (s1 != s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_TEST(! (s1 == s2));
     BOOST_TEST(s1 != s2);
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_CONSTEXPR_ASSERT(! (s1 == s2));
+ BOOST_CONSTEXPR_ASSERT(s1 != s2);
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
     BOOST_TEST(s1 == s2);
- BOOST_TEST(!(s1 != s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::seconds s2(3);
- BOOST_TEST(!(s1 < s2));
- BOOST_TEST(!(s1 > s2));
+ BOOST_TEST(! (s1 != s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(s1 == s2);
+ BOOST_CONSTEXPR_ASSERT(! (s1 != s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(3);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
     BOOST_TEST( (s1 <= s2));
     BOOST_TEST( (s1 >= s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::seconds s1(3);
- BOOST_CONSTEXPR boost::chrono::seconds s2(4);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(3);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::seconds s1(3);
+ boost::chrono::seconds s2(4);
     BOOST_TEST( (s1 < s2));
- BOOST_TEST(!(s1 > s2));
+ BOOST_TEST(! (s1 > s2));
     BOOST_TEST( (s1 <= s2));
- BOOST_TEST(!(s1 >= s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
- BOOST_CONSTEXPR boost::chrono::microseconds s2(3000);
- BOOST_TEST(!(s1 < s2));
- BOOST_TEST(!(s1 > s2));
+ BOOST_TEST(! (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::seconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::seconds s2(4);
+ BOOST_CONSTEXPR_ASSERT( (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 >= s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(3000);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
     BOOST_TEST( (s1 <= s2));
     BOOST_TEST( (s1 >= s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
- BOOST_CONSTEXPR boost::chrono::microseconds s2(4000);
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(3000);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::milliseconds s1(3);
+ boost::chrono::microseconds s2(4000);
     BOOST_TEST( (s1 < s2));
- BOOST_TEST(!(s1 > s2));
+ BOOST_TEST(! (s1 > s2));
     BOOST_TEST( (s1 <= s2));
- BOOST_TEST(!(s1 >= s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
- BOOST_TEST(!(s1 < s2));
- BOOST_TEST(!(s1 > s2));
+ BOOST_TEST(! (s1 >= s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds s1(3);
+ BOOST_CONSTEXPR boost::chrono::microseconds s2(4000);
+ BOOST_CONSTEXPR_ASSERT( (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
     BOOST_TEST( (s1 <= s2));
     BOOST_TEST( (s1 >= s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
- BOOST_TEST(!(s1 < s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_TEST(! (s1 < s2));
     BOOST_TEST( (s1 > s2));
- BOOST_TEST(!(s1 <= s2));
+ BOOST_TEST(! (s1 <= s2));
     BOOST_TEST( (s1 >= s2));
- }
- {
- BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
- BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
- BOOST_TEST(!(s1 < s2));
- BOOST_TEST(!(s1 > s2));
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(10);
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 5> > s2(9);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ {
+ boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_TEST(! (s1 < s2));
+ BOOST_TEST(! (s1 > s2));
     BOOST_TEST( (s1 <= s2));
     BOOST_TEST( (s1 >= s2));
- }
- return boost::report_errors();
+ }
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<2, 3> > s1(9);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 5> > s2(10);
+ BOOST_CONSTEXPR_ASSERT(! (s1 < s2));
+ BOOST_CONSTEXPR_ASSERT(! (s1 > s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 <= s2));
+ BOOST_CONSTEXPR_ASSERT( (s1 >= s2));
+ }
+ return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/duration/constructor_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/duration/constructor_pass.cpp (original)
+++ branches/release/libs/chrono/test/duration/constructor_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -16,26 +16,38 @@
 #include <boost/detail/lightweight_test.hpp>
 
 
-#include <libs/chrono/test/rep.h>
+#include "../rep.h"
 #include <iostream>
 
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
 template <class D>
 void
 check_default()
 {
- //D d=D();
- D d;
- //std::cout << d.count() << std::endl;
- //std::cout << typename D::rep() << std::endl;
+ {
+ D d;
     BOOST_TEST(d.count() == typename D::rep());
+ }
+ {
+ BOOST_CONSTEXPR D d;
+ BOOST_CONSTEXPR_ASSERT(d.count() == typename D::rep());
+ }
 }
 
 template <class D, class R>
 void
 check_from_rep(R r)
 {
+ {
     D d(r);
     BOOST_TEST(d.count() == r);
+ }
 }
 
 int main()
@@ -45,39 +57,71 @@
         boost::chrono::milliseconds ms(1);
         boost::chrono::microseconds us = ms;
         BOOST_TEST(us.count() == 1000);
+ {
+ BOOST_CONSTEXPR boost::chrono::milliseconds ms(1);
+ BOOST_CONSTEXPR boost::chrono::microseconds us = ms;
+ BOOST_CONSTEXPR_ASSERT(us.count() == 1000);
+ }
     }
     // inexact conversions allowed for floating point reps
     {
         boost::chrono::duration<double, boost::micro> us(1);
         boost::chrono::duration<double, boost::milli> ms = us;
         BOOST_TEST(ms.count() == 1./1000);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::micro> us(1);
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::milli> ms = us;
+ BOOST_CONSTEXPR_ASSERT(ms.count() == 1./1000);
+ }
     }
     // Convert int to float
     {
         boost::chrono::duration<int> i(3);
- boost::chrono::duration<int> d = i;
+ boost::chrono::duration<double> d = i;
         BOOST_TEST(d.count() == 3);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int> i(3);
+ BOOST_CONSTEXPR boost::chrono::duration<double> d = i;
+ BOOST_CONSTEXPR_ASSERT(d.count() == 3);
+ }
     }
     // default constructor
     {
- check_default<boost::chrono::duration<Rep> >();
- // constexpr default constructor
- BOOST_CONSTEXPR boost::chrono::duration<int> d;
+ check_default<boost::chrono::duration<Rep> >();
     }
     // constructor from rep
     {
- check_from_rep<boost::chrono::duration<int> >(5);
- BOOST_CONSTEXPR boost::chrono::duration<int> d(5);
+ check_from_rep<boost::chrono::duration<int> >(5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int> d(5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5);
+ }
         check_from_rep<boost::chrono::duration<int, boost::ratio<3, 2> > >(5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<int, boost::ratio<3, 2> > d(5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5);
+ }
         check_from_rep<boost::chrono::duration<Rep, boost::ratio<3, 2> > >(Rep(3));
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<Rep, boost::ratio<3, 2> > d(Rep(3));
+ BOOST_CONSTEXPR_ASSERT(d.count() == Rep(3));
+ }
         check_from_rep<boost::chrono::duration<double, boost::ratio<2, 3> > >(5.5);
- boost::chrono::duration<double, boost::ratio<2, 3> > d2(5.5);
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<double, boost::ratio<3, 2> > d(5.5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5.5);
+ }
+
+
     }
     // constructor from other rep
     {
         boost::chrono::duration<double> d(5);
         BOOST_TEST(d.count() == 5);
- return boost::report_errors();
+ {
+ BOOST_CONSTEXPR boost::chrono::duration<double> d(5);
+ BOOST_CONSTEXPR_ASSERT(d.count() == 5);
+ }
     }
 
     return boost::report_errors();

Modified: branches/release/libs/chrono/test/duration/duration_cast_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/duration/duration_cast_pass.cpp (original)
+++ branches/release/libs/chrono/test/duration/duration_cast_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -18,6 +18,14 @@
 #define NOTHING ""
 #endif
 
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
+
 template <class ToDuration, class FromDuration>
 void
 test(const FromDuration& f, const ToDuration& d)
@@ -43,5 +51,9 @@
          boost::chrono::duration<double, boost::ratio<3600> >(7265./3600));
     test(boost::chrono::duration<int, boost::ratio<2, 3> >(9),
          boost::chrono::duration<int, boost::ratio<3, 5> >(10));
+ {
+ BOOST_CONSTEXPR boost::chrono::hours h = boost::chrono::duration_cast<boost::chrono::hours>(boost::chrono::milliseconds(7265000));
+ BOOST_CONSTEXPR_ASSERT(h.count() == 2);
+ }
     return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/duration/duration_values_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/duration/duration_values_pass.cpp (original)
+++ branches/release/libs/chrono/test/duration/duration_values_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -14,7 +14,13 @@
 #include <boost/chrono/duration.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#include <libs/chrono/test/rep.h>
+#include "../rep.h"
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 template <class D>
 void check_max()
@@ -22,6 +28,11 @@
     typedef typename D::rep Rep;
     Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
     BOOST_TEST((D::max)().count() == max_rep);
+ {
+ typedef typename D::rep Rep;
+ BOOST_CONSTEXPR Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
+ BOOST_CONSTEXPR_ASSERT((D::max)().count() == max_rep);
+ }
 }
 
 template <class D>
@@ -30,6 +41,12 @@
     typedef typename D::rep Rep;
     Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
     BOOST_TEST((D::min)().count() == min_rep);
+ {
+ typedef typename D::rep Rep;
+ BOOST_CONSTEXPR Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
+ BOOST_CONSTEXPR_ASSERT((D::min)().count() == min_rep);
+
+ }
 }
 
 template <class D>
@@ -38,6 +55,12 @@
     typedef typename D::rep Rep;
     Rep zero_rep = boost::chrono::duration_values<Rep>::zero();
     BOOST_TEST(D::zero().count() == zero_rep);
+ {
+ typedef typename D::rep Rep;
+ BOOST_CONSTEXPR Rep zero_rep = boost::chrono::duration_values<Rep>::zero();
+ BOOST_CONSTEXPR_ASSERT(D::zero().count() == zero_rep);
+
+ }
 }
 
 

Modified: branches/release/libs/chrono/test/io/duration_input.cpp
==============================================================================
--- branches/release/libs/chrono/test/io/duration_input.cpp (original)
+++ branches/release/libs/chrono/test/io/duration_input.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -52,12 +52,33 @@
 
   test_good("5000", 5000);
 
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
   test_good("5000 hours", hours(5000));
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
   test_good("5000 minutes", minutes(5000));
   test_good("5000 seconds", seconds(5000));
   test_fail("1.0 second", seconds(1));
 
   test_good("1.0 second", duration<float,ratio<1> >(1));
+ /* BUG with DURATION_GET
+../../../boost/math/common_factor_rt.hpp: In function 'RingType boost::math::detail::gcd_euclidean(RingType, RingType) [with RingType = long double]':
+../../../boost/math/common_factor_rt.hpp:122: instantiated from 'IntegerType boost::math::detail::gcd_integer(const IntegerType&, const IntegerType&) [with IntegerType = long double]'
+../../../boost/math/common_factor_rt.hpp:240: instantiated from 'T boost::math::detail::gcd_optimal_evaluator_helper_t<T, true, true>::operator()(const T&, const T&) [with T = long double]'
+../../../boost/math/common_factor_rt.hpp:290: instantiated from 'T boost::math::detail::gcd_optimal_evaluator<T>::operator()(const T&, const T&) [with T = long double]'
+../../../boost/math/common_factor_rt.hpp:442: instantiated from 'T boost::math::detail::gcd_optimal(const T&, const T&) [with T = long double]'
+../../../boost/math/common_factor_rt.hpp:473: instantiated from 'typename boost::math::gcd_evaluator<IntegerType>::result_type boost::math::gcd_evaluator<IntegerType>::operator()(const IntegerType&, const IntegerType&) const [with IntegerType = long double]'
+../../../boost/math/common_factor_rt.hpp:505: instantiated from 'IntegerType boost::math::gcd(const IntegerType&, const IntegerType&) [with IntegerType = long double]'
+../../../boost/chrono/io/duration_get.hpp:239: instantiated from 'InputIterator boost::chrono::duration_get<CharT, InputIterator>::get(InputIterator, InputIterator, std::ios_base&, std::_Ios_Iostate&, boost::chrono::duration<Rep2, Period2>&, const CharT*, const CharT*) const [with Rep = double, Period = boost::ratio<1l, 1l>, CharT = char, InputIterator = std::istreambuf_iterator<char, std::char_traits<char> >]'
+../../../boost/chrono/io/duration_get.hpp:294: instantiated from 'InputIterator boost::chrono::duration_get<CharT, InputIterator>::get(InputIterator, InputIterator, std::ios_base&, std::_Ios_Iostate&, boost::chrono::duration<Rep2, Period2>&) const [with Rep = double, Period = boost::ratio<1l, 1l>, CharT = char, InputIterator = std::istreambuf_iterator<char, std::char_traits<char> >]'
+../../../boost/chrono/io/duration_io.hpp:593: instantiated from 'std::basic_istream<_CharT, _Traits>& boost::chrono::operator>>(std::basic_istream<_CharT, _Traits>&, boost::chrono::duration<Rep2, Period2>&) [with CharT = char, Traits = std::char_traits<char>, Rep = double, Period = boost::ratio<1l, 1l>]'
+io/duration_input.cpp:15: instantiated from 'void test_good(const char*, D) [with D = boost::chrono::duration<double, boost::ratio<1l, 1l> >]'
+io/duration_input.cpp:52: instantiated from here
+../../../boost/math/common_factor_rt.hpp:102: error: invalid operands of types 'long double' and 'long double' to binary 'operator%'
+../../../boost/math/common_factor_rt.hpp:102: error: in evaluation of 'operator%=(long double, long double)'
+../../../boost/math/common_factor_rt.hpp:106: error: invalid operands of types 'long double' and 'long double' to binary 'operator%'
+../../../boost/math/common_factor_rt.hpp:106: error: in evaluation of 'operator%=(long double, long double)'
+ *
+ */
   test_good("1 second", seconds(1));
   test_not_eof("1 second ", seconds(1));
   test_not_eof("1 seconde", seconds(1));
@@ -71,7 +92,7 @@
   test_good("5000 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (5000));
   test_good("5000 [1/30]second", duration<boost::int_least64_t, ratio<1, 30> > (5000));
   test_good("5000 h", hours(5000));
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   test_good("5000 min", minutes(5000));
 #else
   test_good("5000 m", minutes(5000));
@@ -82,12 +103,17 @@
   test_good("5000 ds", duration<boost::int_least64_t, deci> (5000));
   test_good("5000 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (5000));
   test_not_eof("5000 [1/30]ss", duration<boost::int_least64_t, ratio<1, 30> > (5000));
+ std::cout << __LINE__<< "*****" << std::endl;
   test_good("5000 milliseconds", seconds(5));
   test_good("5000 millisecond", seconds(5));
   test_good("5 milliseconds", nanoseconds(5000000));
+ std::cout << __LINE__<< "*****" << std::endl;
   test_good("4000 ms", seconds(4));
+ std::cout << __LINE__<< "*****" << std::endl;
   test_fail("3001 ms", seconds(3));
+ std::cout << __LINE__<< "*****" << std::endl;
   test_fail("3001 ", milliseconds(3001));
+ std::cout << __LINE__<< "*****" << std::endl;
   test_fail("one ms", milliseconds(1));
   test_fail("5000 millisecon", seconds(5));
   test_not_eof("3001 ms ", milliseconds(3001));

Modified: branches/release/libs/chrono/test/io/duration_output.cpp
==============================================================================
--- branches/release/libs/chrono/test/io/duration_output.cpp (original)
+++ branches/release/libs/chrono/test/io/duration_output.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -20,7 +20,7 @@
 void test_good_symbol(const char* str, D d)
 {
   std::ostringstream out;
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   out << boost::chrono::duration_fmt(boost::chrono::duration_style::symbol) << d;
 #else
   out << boost::chrono::duration_short << d;
@@ -28,10 +28,10 @@
   BOOST_TEST(out.good());
   BOOST_TEST(out.str() == str);
 }
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
 
 template<typename D>
-void test_good(const char* str, D d, boost::chrono::duration_style::type style)
+void test_good(const char* str, D d, boost::chrono::duration_style style)
 {
   std::ostringstream out;
 
@@ -41,7 +41,7 @@
 }
 
 template<typename D>
-void test_state_saver(const char* str, const char* str2, D d, boost::chrono::duration_style::type style)
+void test_state_saver(const char* str, const char* str2, D d, boost::chrono::duration_style style)
 {
   std::ostringstream out;
   {
@@ -75,7 +75,7 @@
   test_good_prefix("5000 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (5000));
 
   test_good_symbol("5000 h", hours(5000));
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   test_good_symbol("5000 min", minutes(5000));
 #else
   test_good_symbol("5000 m", minutes(5000));
@@ -86,7 +86,7 @@
   test_good_symbol("5000 ds", duration<boost::int_least64_t, deci> (5000));
   test_good_symbol("5000 [1/30]s", duration<boost::int_least64_t, ratio<1, 30> > (5000));
 
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   test_good("5000 hours", hours(5000), duration_style::prefix);
   test_good("5000 h", hours(5000), duration_style::symbol);
   test_state_saver("5000 h", "5000 h 5000 hours", hours(5000), duration_style::symbol);

Modified: branches/release/libs/chrono/test/io/time_point_input.cpp
==============================================================================
--- branches/release/libs/chrono/test/io/time_point_input.cpp (original)
+++ branches/release/libs/chrono/test/io/time_point_input.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -71,7 +71,7 @@
   test_good<Clock> ("5000 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (5000));
 
   test_good<Clock> ("5000 h", hours(5000));
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   test_good<Clock>("5000 min", minutes(5000));
 #else
   test_good<Clock> ("5000 m", minutes(5000));

Modified: branches/release/libs/chrono/test/io/time_point_output.cpp
==============================================================================
--- branches/release/libs/chrono/test/io/time_point_output.cpp (original)
+++ branches/release/libs/chrono/test/io/time_point_output.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -24,7 +24,7 @@
 {
   std::ostringstream out;
   boost::chrono::time_point<Clock, D> tp(d);
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   out << boost::chrono::duration_fmt(boost::chrono::duration_style::symbol) << tp;
 #else
   out << boost::chrono::duration_short << tp;
@@ -33,9 +33,9 @@
   BOOST_TEST( (out.str() == std::string(str) + boost::chrono::clock_string<Clock, char>::since()));
 }
 
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
 template<typename Clock, typename D>
-void test_good(const char* str, D d, boost::chrono::duration_style::type style)
+void test_good(const char* str, D d, boost::chrono::duration_style style)
 {
   std::ostringstream out;
   boost::chrono::time_point<Clock,D> tp(d);
@@ -51,7 +51,7 @@
   using namespace boost::chrono;
   using namespace boost;
 
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   test_good<Clock>("2 hours", hours(2), duration_style::prefix);
   test_good<Clock>("2 h", hours(2), duration_style::symbol);
 #endif
@@ -69,7 +69,7 @@
   test_good_prefix<Clock> ("2 [1/30]seconds", duration<boost::int_least64_t, ratio<1, 30> > (2));
 
   test_good_symbol<Clock> ("2 h", hours(2));
-#if defined BOOST_CHRONO_DONT_PROVIDE_DEPRECATED_IO_V1
+#if BOOST_CHRONO_VERSION==2
   test_good_symbol<Clock>("2 min", minutes(2));
 #else
   test_good_symbol<Clock> ("2 m", minutes(2));

Modified: branches/release/libs/chrono/test/rep.h
==============================================================================
--- branches/release/libs/chrono/test/rep.h (original)
+++ branches/release/libs/chrono/test/rep.h 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -14,15 +14,17 @@
 #ifndef REP_H
 #define REP_H
 
+#include <boost/config.hpp>
+
 class Rep
 {
 public:
     int data_;
- Rep() : data_() {}
- explicit Rep(int i) : data_(i) {}
+ BOOST_CONSTEXPR Rep() : data_() {}
+ explicit BOOST_CONSTEXPR Rep(int i) : data_(i) {}
 
- bool operator==(int i) const {return data_ == i;}
- bool operator==(const Rep& r) const {return data_ == r.data_;}
+ BOOST_CONSTEXPR bool operator==(int i) const {return data_ == i;}
+ BOOST_CONSTEXPR bool operator==(const Rep& r) const {return data_ == r.data_;}
 
     Rep& operator*=(Rep x) {data_ *= x.data_; return *this;}
     Rep& operator/=(Rep x) {data_ /= x.data_; return *this;}
@@ -30,7 +32,7 @@
 
 #if 0
 namespace std {
-
+
   template <>
   struct numeric_limits<Rep>
   {
@@ -38,7 +40,7 @@
     {
       return Rep((std::numeric_limits<int>::max)());
     }
-
+
   };
 } // namespace std
 
@@ -52,7 +54,7 @@
   {
     return Rep((std::numeric_limits<int>::max)());
   }
-
+
   static BOOST_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION ()
   {
     return Rep(detail::numeric_limits<Rep>::lowest());

Modified: branches/release/libs/chrono/test/time_point/arithmetic_ext_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/time_point/arithmetic_ext_pass.cpp (original)
+++ branches/release/libs/chrono/test/time_point/arithmetic_ext_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -14,9 +14,15 @@
 #define BOOST_CHRONO_EXTENSIONS
 #include <boost/chrono/chrono.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 int main()
-{
+{
   {
     typedef boost::chrono::system_clock Clock;
     typedef boost::chrono::milliseconds Duration;
@@ -59,34 +65,6 @@
     --t;
     BOOST_TEST(t.time_since_epoch() == Duration(2));
   }
-#if 0
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
- boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
- BOOST_TEST(t2.time_since_epoch() == Duration2(2995));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
- boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
- BOOST_TEST((t1 - t2) == Duration2(2995));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
- boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
- BOOST_TEST(t2.time_since_epoch() == Duration2(3005));
- t2 = Duration2(6) + t1;
- BOOST_TEST(t2.time_since_epoch() == Duration2(3006));
- }
-#endif
-
- return boost::report_errors();
+
+ return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/time_point/arithmetic_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/time_point/arithmetic_pass.cpp (original)
+++ branches/release/libs/chrono/test/time_point/arithmetic_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -13,50 +13,82 @@
 
 #include <boost/chrono/chrono.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 int main()
 {
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration;
- boost::chrono::time_point<Clock, Duration> t(Duration(3));
- t += Duration(2);
- BOOST_TEST(t.time_since_epoch() == Duration(5));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration;
- boost::chrono::time_point<Clock, Duration> t(Duration(3));
- t -= Duration(2);
- BOOST_TEST(t.time_since_epoch() == Duration(1));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
- boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
- BOOST_TEST(t2.time_since_epoch() == Duration2(2995));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
- boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
- BOOST_TEST((t1 - t2) == Duration2(2995));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
- boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
- BOOST_TEST(t2.time_since_epoch() == Duration2(3005));
- t2 = Duration2(6) + t1;
- BOOST_TEST(t2.time_since_epoch() == Duration2(3006));
- }
-#ifdef BOOST_CHRONO_EXTENSIONS
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t += Duration(2);
+ BOOST_TEST(t.time_since_epoch() == Duration(5));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ t -= Duration(2);
+ BOOST_TEST(t.time_since_epoch() == Duration(1));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
+ BOOST_TEST(t2.time_since_epoch() == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
+ BOOST_CONSTEXPR_ASSERT(t2.time_since_epoch() == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
+ BOOST_TEST( (t1 - t2) == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2(Duration2(5));
+ BOOST_CONSTEXPR_ASSERT( (t1 - t2) == Duration2(2995));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
+ BOOST_TEST(t2.time_since_epoch() == Duration2(3005));
+ t2 = Duration2(6) + t1;
+ BOOST_TEST(t2.time_since_epoch() == Duration2(3006));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1(Duration1(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
+ BOOST_CONSTEXPR_ASSERT(t2.time_since_epoch() == Duration2(3005));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t3 = Duration2(6) + t1;
+ BOOST_CONSTEXPR_ASSERT(t3.time_since_epoch() == Duration2(3006));
+ }
+#ifdef BOOST_CHRONO_EXTENSIONS
   {
     typedef boost::chrono::system_clock Clock;
     typedef boost::chrono::milliseconds Duration;
@@ -111,9 +143,9 @@
     BOOST_TEST(t2.time_since_epoch() == Duration2(3005));
     t2 = Duration2(6) + t1;
     BOOST_TEST(t2.time_since_epoch() == Duration2(3006));
- }
-#endif
-#endif
-
- return boost::report_errors();
+ }
+#endif
+#endif
+
+ return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/time_point/comparisons_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/time_point/comparisons_pass.cpp (original)
+++ branches/release/libs/chrono/test/time_point/comparisons_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -13,71 +13,134 @@
 
 #include <boost/chrono/chrono.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
 
 int main()
 {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration1;
- typedef boost::chrono::microseconds Duration2;
- typedef boost::chrono::time_point<Clock, Duration1> T1;
- typedef boost::chrono::time_point<Clock, Duration2> T2;
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration1;
+ typedef boost::chrono::microseconds Duration2;
+ typedef boost::chrono::time_point<Clock, Duration1> T1;
+ typedef boost::chrono::time_point<Clock, Duration2> T2;
 
- {
- T1 t1(Duration1(3));
- T1 t2(Duration1(3));
- BOOST_TEST( (t1 == t2));
- BOOST_TEST(!(t1 != t2));
- }
- {
- T1 t1(Duration1(3));
- T1 t2(Duration1(4));
- BOOST_TEST(!(t1 == t2));
- BOOST_TEST( (t1 != t2));
- }
- {
- T1 t1(Duration1(3));
- T2 t2(Duration2(3000));
- BOOST_TEST( (t1 == t2));
- BOOST_TEST(!(t1 != t2));
- }
- {
- T1 t1(Duration1(3));
- T2 t2(Duration2(3001));
- BOOST_TEST(!(t1 == t2));
- BOOST_TEST( (t1 != t2));
- }
- {
- T1 t1(Duration1(3));
- T1 t2(Duration1(3));
- BOOST_TEST(!(t1 < t2));
- BOOST_TEST(!(t1 > t2));
- BOOST_TEST( (t1 <= t2));
- BOOST_TEST( (t1 >= t2));
- }
- {
- T1 t1(Duration1(3));
- T1 t2(Duration1(4));
- BOOST_TEST( (t1 < t2));
- BOOST_TEST(!(t1 > t2));
- BOOST_TEST( (t1 <= t2));
- BOOST_TEST(!(t1 >= t2));
- }
- {
- T1 t1(Duration1(3));
- T2 t2(Duration2(3000));
- BOOST_TEST(!(t1 < t2));
- BOOST_TEST(!(t1 > t2));
- BOOST_TEST( (t1 <= t2));
- BOOST_TEST( (t1 >= t2));
- }
- {
- T1 t1(Duration1(3));
- T2 t2(Duration2(3001));
- BOOST_TEST( (t1 < t2));
- BOOST_TEST(!(t1 > t2));
- BOOST_TEST( (t1 <= t2));
- BOOST_TEST(!(t1 >= t2));
- }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(3));
+ BOOST_TEST( (t1 == t2));
+ BOOST_TEST(! (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(3));
+ BOOST_CONSTEXPR_ASSERT( (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(4));
+ BOOST_TEST(! (t1 == t2));
+ BOOST_TEST( (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(4));
+ BOOST_CONSTEXPR_ASSERT(! (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3000));
+ BOOST_TEST( (t1 == t2));
+ BOOST_TEST(! (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3000));
+ BOOST_CONSTEXPR_ASSERT( (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3001));
+ BOOST_TEST(! (t1 == t2));
+ BOOST_TEST( (t1 != t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3001));
+ BOOST_CONSTEXPR_ASSERT(! (t1 == t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 != t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(3));
+ BOOST_TEST(! (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST( (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(3));
+ BOOST_CONSTEXPR_ASSERT(! (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 >= t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T1 t2(Duration1(4));
+ BOOST_TEST( (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST(! (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T1 t2(Duration1(4));
+ BOOST_CONSTEXPR_ASSERT( (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 >= t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3000));
+ BOOST_TEST(! (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST( (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3000));
+ BOOST_CONSTEXPR_ASSERT(! (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 >= t2));
+ }
+ {
+ T1 t1(Duration1(3));
+ T2 t2(Duration2(3001));
+ BOOST_TEST( (t1 < t2));
+ BOOST_TEST(! (t1 > t2));
+ BOOST_TEST( (t1 <= t2));
+ BOOST_TEST(! (t1 >= t2));
+ }
+ {
+ BOOST_CONSTEXPR T1 t1(Duration1(3));
+ BOOST_CONSTEXPR T2 t2(Duration2(3001));
+ BOOST_CONSTEXPR_ASSERT( (t1 < t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 > t2));
+ BOOST_CONSTEXPR_ASSERT( (t1 <= t2));
+ BOOST_CONSTEXPR_ASSERT(! (t1 >= t2));
+ }
 
- return boost::report_errors();
+ return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/time_point/constructor_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/time_point/constructor_pass.cpp (original)
+++ branches/release/libs/chrono/test/time_point/constructor_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -13,37 +13,68 @@
 
 #include <boost/chrono/chrono.hpp>
 #include <boost/detail/lightweight_test.hpp>
-#include <libs/chrono/test/rep.h>
+#include "../rep.h"
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 int main()
 {
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::microseconds Duration1;
- typedef boost::chrono::milliseconds Duration2;
- boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
- boost::chrono::time_point<Clock, Duration1> t1 = t2;
- BOOST_TEST(t1.time_since_epoch() == Duration1(3000));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::duration<Rep, boost::milli> Duration;
- boost::chrono::time_point<Clock, Duration> t;
- BOOST_TEST(t.time_since_epoch() == Duration::zero());
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration;
- boost::chrono::time_point<Clock, Duration> t(Duration(3));
- BOOST_TEST(t.time_since_epoch() == Duration(3));
- }
- {
- typedef boost::chrono::system_clock Clock;
- typedef boost::chrono::milliseconds Duration;
- boost::chrono::time_point<Clock, Duration> t(boost::chrono::seconds(3));
- BOOST_TEST(t.time_since_epoch() == Duration(3000));
- }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::microseconds Duration1;
+ typedef boost::chrono::milliseconds Duration2;
+ boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
+ boost::chrono::time_point<Clock, Duration1> t1 = t2;
+ BOOST_TEST(t1.time_since_epoch() == Duration1(3000));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::microseconds Duration1;
+ typedef boost::chrono::milliseconds Duration2;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration1> t1 = t2;
+ BOOST_CONSTEXPR_ASSERT(t1.time_since_epoch() == Duration1(3000));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::duration<Rep, boost::milli> Duration;
+ boost::chrono::time_point<Clock, Duration> t;
+ BOOST_TEST(t.time_since_epoch() == Duration::zero());
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::duration<Rep, boost::milli> Duration;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration> t;
+ BOOST_CONSTEXPR_ASSERT(t.time_since_epoch() == Duration::zero());
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ BOOST_TEST(t.time_since_epoch() == Duration(3));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration> t(Duration(3));
+ BOOST_CONSTEXPR_ASSERT(t.time_since_epoch() == Duration(3));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ boost::chrono::time_point<Clock, Duration> t(boost::chrono::seconds(3));
+ BOOST_TEST(t.time_since_epoch() == Duration(3000));
+ }
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::milliseconds Duration;
+ BOOST_CONSTEXPR boost::chrono::time_point<Clock, Duration> t(boost::chrono::seconds(3));
+ BOOST_CONSTEXPR_ASSERT(t.time_since_epoch() == Duration(3000));
+ }
 
-
- return boost::report_errors();
+ return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/time_point/min_max_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/time_point/min_max_pass.cpp (original)
+++ branches/release/libs/chrono/test/time_point/min_max_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -14,14 +14,21 @@
 #include <boost/chrono/chrono.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
+
 int main()
 {
     typedef boost::chrono::system_clock Clock;
     typedef boost::chrono::milliseconds Duration;
     typedef boost::chrono::time_point<Clock, Duration> TP;
-
- BOOST_TEST((TP::min)() == TP((Duration::min)()));
- BOOST_TEST((TP::max)() == TP((Duration::max)()));
+
+ BOOST_CONSTEXPR_ASSERT((TP::min)() == TP((Duration::min)()));
+ BOOST_CONSTEXPR_ASSERT((TP::max)() == TP((Duration::max)()));
 
     return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/time_point/time_point_cast_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/time_point/time_point_cast_pass.cpp (original)
+++ branches/release/libs/chrono/test/time_point/time_point_cast_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -18,6 +18,12 @@
 #if !defined(BOOST_NO_STATIC_ASSERT)
 #define NOTHING ""
 #endif
+#ifdef BOOST_NO_CONSTEXPR
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
+#else
+#include <boost/static_assert.hpp>
+#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
+#endif
 
 template <class FromDuration, class ToDuration>
 void
@@ -32,7 +38,7 @@
     //~ typedef BOOST_TYPEOF_TPL(boost::chrono::time_point_cast<ToDuration>(f)) R;
 //~ #else
     //~ typedef decltype(boost::chrono::time_point_cast<ToDuration>(f)) R;
-//~ #endif
+//~ #endif
     //~ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<R, ToTimePoint>::value), NOTHING, ());
     BOOST_TEST(boost::chrono::time_point_cast<ToDuration>(f) == t);
 }
@@ -49,6 +55,13 @@
          boost::chrono::duration<double, boost::ratio<3600> >(7265./3600));
     test(boost::chrono::duration<int, boost::ratio<2, 3> >(9),
          boost::chrono::duration<int, boost::ratio<3, 5> >(10));
-
+ {
+ typedef boost::chrono::system_clock Clock;
+ typedef boost::chrono::time_point<Clock, boost::chrono::milliseconds> FromTimePoint;
+ typedef boost::chrono::time_point<Clock, boost::chrono::hours> ToTimePoint;
+ BOOST_CONSTEXPR FromTimePoint f(boost::chrono::milliseconds(7265000));
+ BOOST_CONSTEXPR ToTimePoint tph = boost::chrono::time_point_cast<boost::chrono::hours>(f);
+ BOOST_CONSTEXPR_ASSERT(tph.time_since_epoch().count() == 2);
+ }
     return boost::report_errors();
 }

Modified: branches/release/libs/chrono/test/traits/duration_values_pass.cpp
==============================================================================
--- branches/release/libs/chrono/test/traits/duration_values_pass.cpp (original)
+++ branches/release/libs/chrono/test/traits/duration_values_pass.cpp 2012-09-06 16:12:53 EDT (Thu, 06 Sep 2012)
@@ -16,7 +16,7 @@
 #include <limits>
 #include <boost/detail/lightweight_test.hpp>
 
-#include <libs/chrono/test/rep.h>
+#include "../rep.h"
 
 int main()
 {
@@ -26,7 +26,7 @@
            -(std::numeric_limits<double>::max)());
     BOOST_TEST((boost::chrono::duration_values<Rep>::min)() ==
            (std::numeric_limits<Rep>::min)());
-
+
     BOOST_TEST((boost::chrono::duration_values<int>::max)() ==
            (std::numeric_limits<int>::max)());
     BOOST_TEST((boost::chrono::duration_values<double>::max)() ==


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