Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53618 - in branches/release: boost/date_time boost/date_time/gregorian boost/date_time/local_time boost/date_time/posix_time libs/date_time/test/gregorian libs/date_time/test/posix_time
From: andrey.semashev_at_[hidden]
Date: 2009-06-04 04:24:51


Author: andysem
Date: 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
New Revision: 53618
URL: http://svn.boost.org/trac/boost/changeset/53618

Log:
Merged fixes for #287, #1859 and partially #1861. Improved diagnostics in case of test failures.
Text files modified:
   branches/release/boost/date_time/date_parsing.hpp | 142 ++++++++++++---------
   branches/release/boost/date_time/format_date_parser.hpp | 10
   branches/release/boost/date_time/gregorian/conversion.hpp | 14 +-
   branches/release/boost/date_time/local_time/conversion.hpp | 5
   branches/release/boost/date_time/posix_time/conversion.hpp | 12 -
   branches/release/boost/date_time/time_duration.hpp | 51 ++++---
   branches/release/libs/date_time/test/gregorian/testdate_facet_new.cpp | 16 +-
   branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp | 260 ++++++++++++++++++++--------------------
   branches/release/libs/date_time/test/gregorian/testformat_date_parser.cpp | 30 ++--
   branches/release/libs/date_time/test/posix_time/testtime_input_facet.cpp | 124 +++++++++---------
   10 files changed, 335 insertions(+), 329 deletions(-)

Modified: branches/release/boost/date_time/date_parsing.hpp
==============================================================================
--- branches/release/boost/date_time/date_parsing.hpp (original)
+++ branches/release/boost/date_time/date_parsing.hpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -2,7 +2,7 @@
 #define _DATE_TIME_DATE_PARSING_HPP___
 
 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
- * Use, modification and distribution is subject to the
+ * Use, modification and distribution is subject to the
  * Boost Software License, Version 1.0. (See accompanying
  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  * Author: Jeff Garland, Bart Garst
@@ -29,11 +29,11 @@
   //! A function to replace the std::transform( , , ,tolower) construct
   /*! This function simply takes a string, and changes all the characters
    * in that string to lowercase (according to the default system locale).
- * In the event that a compiler does not support locales, the old
+ * In the event that a compiler does not support locales, the old
    * C style tolower() is used.
    */
   inline
- std::string
+ std::string
   convert_to_lower(std::string inp)
   {
 #if !defined(BOOST_DATE_TIME_NO_LOCALE)
@@ -57,11 +57,11 @@
     /* Used by-value parameter because we change the string and may
      * want to preserve the original argument */
     template<class month_type>
- inline unsigned short
+ inline unsigned short
     month_str_to_ushort(std::string const& s) {
       if((s.at(0) >= '0') && (s.at(0) <= '9')) {
         return boost::lexical_cast<unsigned short>(s);
- }
+ }
       else {
         std::string str = convert_to_lower(s);
         typename month_type::month_map_ptr_type ptr = month_type::get_month_map_ptr();
@@ -81,8 +81,8 @@
      * 'size' can be sent in with: (greg_month::max)() (which 12),
      * (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */
     template<class charT>
- short find_match(const charT* const* short_names,
- const charT* const* long_names,
+ short find_match(const charT* const* short_names,
+ const charT* const* long_names,
                      short size,
                      const std::basic_string<charT>& s) {
       for(short i = 0; i < size; ++i){
@@ -92,12 +92,12 @@
       }
       return size; // not-found, return a value out of range
     }
-
+
     //! Generic function to parse a delimited date (eg: 2002-02-10)
     /*! Accepted formats are: "2003-02-10" or " 2003-Feb-10" or
- * "2003-Feburary-10"
- * The order in which the Month, Day, & Year appear in the argument
- * string can be accomodated by passing in the appropriate ymd_order_spec
+ * "2003-Feburary-10"
+ * The order in which the Month, Day, & Year appear in the argument
+ * string can be accomodated by passing in the appropriate ymd_order_spec
      */
     template<class date_type>
     date_type
@@ -105,14 +105,14 @@
       std::string spec_str;
       if(order_spec == ymd_order_iso) {
         spec_str = "ymd";
- }
+ }
       else if(order_spec == ymd_order_dmy) {
         spec_str = "dmy";
- }
+ }
       else { // (order_spec == ymd_order_us)
         spec_str = "mdy";
       }
-
+
       typedef typename date_type::year_type year_type;
       typedef typename date_type::month_type month_type;
       unsigned pos = 0;
@@ -129,21 +129,21 @@
       const char sep_char[] = {',','-','.',' ','/','\0'};
       char_separator_type sep(sep_char);
       tokenizer tok(s,sep);
- for(tokenizer_iterator beg=tok.begin();
- beg!=tok.end() && pos < spec_str.size();
+ for(tokenizer_iterator beg=tok.begin();
+ beg!=tok.end() && pos < spec_str.size();
           ++beg, ++pos) {
         switch(spec_str.at(pos)) {
- case 'y':
+ case 'y':
           {
             year = boost::lexical_cast<unsigned short>(*beg);
             break;
           }
- case 'm':
+ case 'm':
           {
             month = month_str_to_ushort<month_type>(*beg);
             break;
           }
- case 'd':
+ case 'd':
           {
             day = boost::lexical_cast<unsigned short>(*beg);
             break;
@@ -152,7 +152,7 @@
       }
       return date_type(year, month, day);
     }
-
+
     //! Generic function to parse undelimited date (eg: 20020201)
     template<class date_type>
     date_type
@@ -162,16 +162,16 @@
       typedef typename date_type::year_type year_type;
       //typename date_type::ymd_type ymd((year_type::min)(),1,1);
       unsigned short y = 0, m = 0, d = 0;
-
- /* The two bool arguments state that parsing will not wrap
- * (only the first 8 characters will be parsed) and partial
- * strings will not be parsed.
+
+ /* The two bool arguments state that parsing will not wrap
+ * (only the first 8 characters will be parsed) and partial
+ * strings will not be parsed.
        * Ex:
        * "2005121" will parse 2005 & 12, but not the "1" */
       boost::offset_separator osf(offsets, offsets+3, false, false);
-
- typedef typename boost::tokenizer<boost::offset_separator,
- std::basic_string<char>::const_iterator,
+
+ typedef typename boost::tokenizer<boost::offset_separator,
+ std::basic_string<char>::const_iterator,
                                         std::basic_string<char> > tokenizer_type;
       tokenizer_type tok(s, osf);
       for(typename tokenizer_type::iterator ti=tok.begin(); ti!=tok.end();++ti) {
@@ -185,17 +185,17 @@
       }
       return date_type(y,m,d);
     }
-
+
     //! Helper function for 'date gregorian::from_stream()'
     /*! Creates a string from the iterators that reference the
- * begining & end of a char[] or string. All elements are
+ * begining & end of a char[] or string. All elements are
      * used in output string */
     template<class date_type, class iterator_type>
- inline
+ inline
     date_type
- from_stream_type(iterator_type& beg,
- iterator_type& end,
- char)
+ from_stream_type(iterator_type& beg,
+ iterator_type const& end,
+ char)
     {
       std::ostringstream ss;
       while(beg != end) {
@@ -203,16 +203,16 @@
       }
       return parse_date<date_type>(ss.str());
     }
-
+
     //! Helper function for 'date gregorian::from_stream()'
     /*! Returns the first string found in the stream referenced by the
      * begining & end iterators */
     template<class date_type, class iterator_type>
- inline
+ inline
     date_type
- from_stream_type(iterator_type& beg,
- iterator_type& /* end */,
- std::string)
+ from_stream_type(iterator_type& beg,
+ iterator_type const& /* end */,
+ std::string const&)
     {
       return parse_date<date_type>(*beg);
     }
@@ -221,22 +221,30 @@
      * parse_date<>()? In the mean time this gets us started... */
     //! Helper function for 'date gregorian::from_stream()'
     /*! Creates a string from the iterators that reference the
- * begining & end of a wstring. All elements are
+ * begining & end of a wstring. All elements are
      * used in output string */
     template<class date_type, class iterator_type>
- inline
- date_type from_stream_type(iterator_type& beg,
- iterator_type& end,
- wchar_t)
+ inline
+ date_type from_stream_type(iterator_type& beg,
+ iterator_type const& end,
+ wchar_t)
     {
       std::ostringstream ss;
- while(beg != end) {
 #if !defined(BOOST_DATE_TIME_NO_LOCALE)
- ss << std::use_facet<std::ctype<wchar_t> >(std::locale()).narrow(*beg++, 'X'); // 'X' will cause exception to be thrown
+ std::locale loc;
+ std::ctype<wchar_t> const& fac = std::use_facet<std::ctype<wchar_t> >(loc);
+ while(beg != end) {
+ ss << fac.narrow(*beg++, 'X'); // 'X' will cause exception to be thrown
+ }
 #else
- ss << ss.narrow(*beg++, 'X');
-#endif
+ while(beg != end) {
+ char c = 'X'; // 'X' will cause exception to be thrown
+ const wchar_t wc = *beg++;
+ if (wc >= 0 && wc <= 127)
+ c = static_cast< char >(wc);
+ ss << c;
       }
+#endif
       return parse_date<date_type>(ss.str());
     }
 #ifndef BOOST_NO_STD_WSTRING
@@ -244,21 +252,29 @@
     /*! Creates a string from the first wstring found in the stream
      * referenced by the begining & end iterators */
     template<class date_type, class iterator_type>
- inline
+ inline
     date_type
- from_stream_type(iterator_type& beg,
- iterator_type& /* end */,
- std::wstring) {
+ from_stream_type(iterator_type& beg,
+ iterator_type const& /* end */,
+ std::wstring const&) {
       std::wstring ws = *beg;
       std::ostringstream ss;
       std::wstring::iterator wsb = ws.begin(), wse = ws.end();
- while(wsb != wse) {
 #if !defined(BOOST_DATE_TIME_NO_LOCALE)
- ss << std::use_facet<std::ctype<wchar_t> >(std::locale()).narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown
+ std::locale loc;
+ std::ctype<wchar_t> const& fac = std::use_facet<std::ctype<wchar_t> >(loc);
+ while(wsb != wse) {
+ ss << fac.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown
+ }
 #else
- ss << ss.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown
-#endif
+ while(wsb != wse) {
+ char c = 'X'; // 'X' will cause exception to be thrown
+ const wchar_t wc = *wsb++;
+ if (wc >= 0 && wc <= 127)
+ c = static_cast< char >(wc);
+ ss << c;
       }
+#endif
       return parse_date<date_type>(ss.str());
     }
 #endif // BOOST_NO_STD_WSTRING
@@ -267,27 +283,27 @@
 #else
     //! function called by wrapper functions: date_period_from_(w)string()
     template<class date_type, class charT>
- period<date_type, typename date_type::duration_type>
+ period<date_type, typename date_type::duration_type>
     from_simple_string_type(const std::basic_string<charT>& s){
       typedef typename std::basic_string<charT>::traits_type traits_type;
       typedef typename boost::char_separator<charT, traits_type> char_separator;
- typedef typename boost::tokenizer<char_separator,
- typename std::basic_string<charT>::const_iterator,
+ typedef typename boost::tokenizer<char_separator,
+ typename std::basic_string<charT>::const_iterator,
                                         std::basic_string<charT> > tokenizer;
       const charT sep_list[4] = {'[','/',']','\0'};
       char_separator sep(sep_list);
       tokenizer tokens(s, sep);
- typename tokenizer::iterator tok_it = tokens.begin();
+ typename tokenizer::iterator tok_it = tokens.begin();
       std::basic_string<charT> date_string = *tok_it;
       // get 2 string iterators and generate a date from them
- typename std::basic_string<charT>::iterator date_string_start = date_string.begin(),
- date_string_end = date_string.end();
+ typename std::basic_string<charT>::iterator date_string_start = date_string.begin(),
+ date_string_end = date_string.end();
       typedef typename std::iterator_traits<typename std::basic_string<charT>::iterator>::value_type value_type;
       date_type d1 = from_stream_type<date_type>(date_string_start, date_string_end, value_type());
       date_string = *(++tok_it); // next token
- date_string_start = date_string.begin(), date_string_end = date_string.end();
+ date_string_start = date_string.begin(), date_string_end = date_string.end();
       date_type d2 = from_stream_type<date_type>(date_string_start, date_string_end, value_type());
- return period<date_type, typename date_type::duration_type>(d1, d2);
+ return period<date_type, typename date_type::duration_type>(d1, d2);
     }
 #endif
 

Modified: branches/release/boost/date_time/format_date_parser.hpp
==============================================================================
--- branches/release/boost/date_time/format_date_parser.hpp (original)
+++ branches/release/boost/date_time/format_date_parser.hpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -100,19 +100,19 @@
 inline
 int_type
 var_string_to_int(std::istreambuf_iterator<charT>& itr,
- std::istreambuf_iterator<charT>& /* stream_end */,
+ const std::istreambuf_iterator<charT>& stream_end,
                   unsigned int max_length)
 {
   typedef std::basic_string<charT> string_type;
   unsigned int j = 0;
   string_type s;
- while ((j < max_length) && std::isdigit(*itr)) {
+ while (itr != stream_end && (j < max_length) && std::isdigit(*itr)) {
     s += (*itr);
- itr++;
- j++;
+ ++itr;
+ ++j;
   }
   int_type i = -1;
- if(s.length() != 0) {
+ if(!s.empty()) {
     i = boost::lexical_cast<int_type>(s);
   }
   return i;

Modified: branches/release/boost/date_time/gregorian/conversion.hpp
==============================================================================
--- branches/release/boost/date_time/gregorian/conversion.hpp (original)
+++ branches/release/boost/date_time/gregorian/conversion.hpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -32,7 +32,7 @@
 
   //! Converts a date to a tm struct. Throws out_of_range exception if date is a special value
   inline
- std::tm to_tm(const date& d)
+ std::tm to_tm(const date& d)
   {
     if(d.is_pos_infinity() || d.is_neg_infinity() || d.is_not_a_date()){
       std::string s = "tm unable to handle date value of ";
@@ -45,10 +45,10 @@
 #endif // USE_DATE_TIME_PRE_1_33_FACET_IO
       boost::throw_exception(std::out_of_range(s));
     }
- std::tm datetm;
+ std::tm datetm = {}; // zero initialization is needed for extension members, like tm_zone
     boost::gregorian::date::ymd_type ymd = d.year_month_day();
- datetm.tm_year = ymd.year-1900;
- datetm.tm_mon = ymd.month-1;
+ datetm.tm_year = ymd.year-1900;
+ datetm.tm_mon = ymd.month-1;
     datetm.tm_mday = ymd.day;
     datetm.tm_wday = d.day_of_week();
     datetm.tm_yday = d.day_of_year()-1;
@@ -61,11 +61,11 @@
   inline
   date date_from_tm(const std::tm& datetm)
   {
- return date(static_cast<unsigned short>(datetm.tm_year+1900),
- static_cast<unsigned short>(datetm.tm_mon+1),
+ return date(static_cast<unsigned short>(datetm.tm_year+1900),
+ static_cast<unsigned short>(datetm.tm_mon+1),
                 static_cast<unsigned short>(datetm.tm_mday));
   }
-
+
 
 } } //namespace boost::gregorian
 

Modified: branches/release/boost/date_time/local_time/conversion.hpp
==============================================================================
--- branches/release/boost/date_time/local_time/conversion.hpp (original)
+++ branches/release/boost/date_time/local_time/conversion.hpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -18,9 +18,8 @@
 
 //! Function that creates a tm struct from a local_date_time
 inline
-tm to_tm(const local_date_time& lt) {
- tm lt_tm;
- lt_tm = posix_time::to_tm(lt.local_time());
+std::tm to_tm(const local_date_time& lt) {
+ std::tm lt_tm = posix_time::to_tm(lt.local_time());
   if(lt.is_dst()){
     lt_tm.tm_isdst = 1;
   }

Modified: branches/release/boost/date_time/posix_time/conversion.hpp
==============================================================================
--- branches/release/boost/date_time/posix_time/conversion.hpp (original)
+++ branches/release/boost/date_time/posix_time/conversion.hpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -22,7 +22,7 @@
 
   //! Function that converts a time_t into a ptime.
   inline
- ptime from_time_t(std::time_t t)
+ ptime from_time_t(std::time_t t)
   {
     ptime start(gregorian::date(1970,1,1));
     return start + seconds(static_cast<long>(t));
@@ -42,14 +42,8 @@
   //! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components
   inline
   std::tm to_tm(const boost::posix_time::time_duration& td) {
- std::tm timetm;
- timetm.tm_year = 0;
- timetm.tm_mon = 0;
- timetm.tm_mday = 0;
- timetm.tm_wday = 0;
- timetm.tm_yday = 0;
-
- timetm.tm_hour = date_time::absolute_value(td.hours());
+ std::tm timetm = {};
+ timetm.tm_hour = date_time::absolute_value(td.hours());
     timetm.tm_min = date_time::absolute_value(td.minutes());
     timetm.tm_sec = date_time::absolute_value(td.seconds());
     timetm.tm_isdst = -1; // -1 used when dst info is unknown

Modified: branches/release/boost/date_time/time_duration.hpp
==============================================================================
--- branches/release/boost/date_time/time_duration.hpp (original)
+++ branches/release/boost/date_time/time_duration.hpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -9,15 +9,16 @@
  * $Date$
  */
 
-#include "boost/operators.hpp"
-#include "boost/date_time/time_defs.hpp"
-#include "boost/date_time/special_defs.hpp"
-#include "boost/date_time/compiler_config.hpp"
+#include <boost/cstdint.hpp>
+#include <boost/operators.hpp>
+#include <boost/date_time/time_defs.hpp>
+#include <boost/date_time/special_defs.hpp>
+#include <boost/date_time/compiler_config.hpp>
 
 namespace boost {
 namespace date_time {
 
-
+
   //! Represents some amount of elapsed time measure to a given resolution
   /*! This class represents a standard set of capabilities for all
       counted time durations. Time duration implementations should derive
@@ -30,13 +31,13 @@
   */
   template<class T, typename rep_type>
   class time_duration : private
- boost::less_than_comparable<T
+ boost::less_than_comparable<T
     , boost::equality_comparable<T
> >
   /* dividable, addable, and subtractable operator templates
- * won't work with this class (MSVC++ 6.0). return type
- * from '+=' is different than expected return type
- * from '+'. multipliable probably wont work
+ * won't work with this class (MSVC++ 6.0). return type
+ * from '+=' is different than expected return type
+ * from '+'. multipliable probably wont work
    * either (haven't tried) */
   {
   public:
@@ -50,12 +51,12 @@
     typedef typename rep_type::tick_type tick_type;
     typedef typename rep_type::impl_type impl_type;
 
- time_duration() : ticks_(0) {}
- time_duration(hour_type hours_in,
- min_type minutes_in,
+ time_duration() : ticks_(0) {}
+ time_duration(hour_type hours_in,
+ min_type minutes_in,
                   sec_type seconds_in=0,
                   fractional_seconds_type frac_sec_in = 0) :
- ticks_(rep_type::to_tick_count(hours_in,minutes_in,seconds_in,frac_sec_in))
+ ticks_(rep_type::to_tick_count(hours_in,minutes_in,seconds_in,frac_sec_in))
     {}
     // copy constructor required for dividable<>
     //! Construct from another time_duration (Copy constructor)
@@ -136,17 +137,17 @@
     }
     duration_type invert_sign() const
     {
- return duration_type(ticks_ * (-1));
- }
+ return duration_type(ticks_ * (-1));
+ }
     bool is_negative() const
     {
       return ticks_ < 0;
- }
- bool operator<(const time_duration& rhs) const
+ }
+ bool operator<(const time_duration& rhs) const
     {
       return ticks_ < rhs.ticks_;
     }
- bool operator==(const time_duration& rhs) const
+ bool operator==(const time_duration& rhs) const
     {
       return ticks_ == rhs.ticks_;
     }
@@ -188,13 +189,13 @@
     {
       return duration_type(ticks_ * rhs);
     }
- duration_type operator*=(int divisor)
+ duration_type operator*=(int divisor)
     {
       ticks_ = ticks_ * divisor;
       return duration_type(ticks_);
     }
- tick_type ticks() const
- {
+ tick_type ticks() const
+ {
       return traits_type::as_number(ticks_);
     }
 
@@ -258,9 +259,9 @@
 
   //! Template for instantiating derived adjusting durations
   /* These templates are designed to work with multiples of
- * 10 for frac_of_second and resoultion adjustment
+ * 10 for frac_of_second and resoultion adjustment
    */
- template<class base_duration, boost::int64_t frac_of_second>
+ template<class base_duration, boost::int64_t frac_of_second>
   class subsecond_duration : public base_duration
   {
   public:
@@ -270,8 +271,8 @@
     {}
   };
 
-
-
+
+
 } } //namespace date_time
 
 

Modified: branches/release/libs/date_time/test/gregorian/testdate_facet_new.cpp
==============================================================================
--- branches/release/libs/date_time/test/gregorian/testdate_facet_new.cpp (original)
+++ branches/release/libs/date_time/test/gregorian/testdate_facet_new.cpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -17,8 +17,8 @@
 
 template<class temporal_type, typename charT>
 inline
-void
-teststreaming(std::string testname,
+void
+teststreaming(std::string testname,
               temporal_type value,
               std::basic_string<charT> expected_result,
               const std::locale& locale = std::locale::classic())
@@ -26,7 +26,7 @@
   std::basic_stringstream<charT> ss;
   ss.imbue(locale);
   ss << value;
- check(testname, ss.str() == expected_result);
+ check_equal(testname, ss.str(), expected_result);
 }
 
 
@@ -76,20 +76,20 @@
 
 int main() {
   using namespace boost::gregorian;
-
- std::copy(&month_short_names[0],
+
+ std::copy(&month_short_names[0],
             &month_short_names[12],
             std::back_inserter(short_month_names));
 
- std::copy(&month_long_names[0],
+ std::copy(&month_long_names[0],
             &month_long_names[12],
             std::back_inserter(long_month_names));
 
- std::copy(&weekday_short_names[0],
+ std::copy(&weekday_short_names[0],
             &weekday_short_names[7],
             std::back_inserter(short_weekday_names));
 
- std::copy(&weekday_long_names[0],
+ std::copy(&weekday_long_names[0],
             &weekday_long_names[7],
             std::back_inserter(long_weekday_names));
 

Modified: branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp
==============================================================================
--- branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp (original)
+++ branches/release/libs/date_time/test/gregorian/testdate_input_facet.cpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -100,17 +100,17 @@
   // default format tests: date, days, month, weekday, day, year
   std::istringstream iss("2005-Jan-15 21 Feb Tue 4 2002");
   iss >> d;
- check("Default format date", d == date(2005,Jan,15));
+ check_equal("Default format date", d, date(2005,Jan,15));
   iss >> dd;
- check("Default (only) format positive days", dd == days(21));
+ check_equal("Default (only) format positive days", dd, days(21));
   iss >> m;
- check("Default format month", m == greg_month(2));
+ check_equal("Default format month", m, greg_month(2));
   iss >> gw;
- check("Default format weekday", gw == greg_weekday(2));
+ check_equal("Default format weekday", gw, greg_weekday(2));
   iss >> gd;
- check("Default (only) format day of month", gd == greg_day(4));
+ check_equal("Default (only) format day of month", gd, greg_day(4));
   iss >> gy;
- check("Default format year", gy == greg_year(2002));
+ check_equal("Default format year", gy, greg_year(2002));
   // failure tests
   check("Input Misspelled in year (date) w/exceptions",
       failure_test(d, "205-Jan-15", e_bad_year, new date_input_facet()));
@@ -151,15 +151,15 @@
   iss.imbue(std::locale(std::locale::classic(), facet));
 
   iss >> d;
- check("ISO format date", d == date(2005,Jan,15));
+ check_equal("ISO format date", d, date(2005,Jan,15));
   iss >> dd;
- check("Default (only) format negative days", dd == days(-55));
+ check_equal("Default (only) format negative days", dd, days(-55));
   iss >> m;
- check("Full format month", m == greg_month(2));
+ check_equal("Full format month", m, greg_month(2));
   iss >> gw;
- check("Full format weekday", gw == greg_weekday(2));
+ check_equal("Full format weekday", gw, greg_weekday(2));
   iss >> gy;
- check("2 digit format year", gy == greg_year(2002));
+ check_equal("2 digit format year", gy, greg_year(2002));
 
   date_input_facet* f1 = new date_input_facet();
   date_input_facet* f2 = new date_input_facet();
@@ -177,41 +177,41 @@
     date_input_facet* f = new date_input_facet("%%d %Y-%b-%d");
     std::stringstream ss;
     ss.imbue(std::locale(ss.getloc(), f));
-
+
     ss.str("%d 2005-Jun-14");
     ss >> d;
- check("Literal '%' in date format", d == date(2005,Jun,14));
+ check_equal("Literal '%' in date format", d, date(2005,Jun,14));
     f->format("%%%d %Y-%b-%d");
     ss.str("%14 2005-Jun-14");
     ss >> d;
- check("Multiple literal '%'s in date format", d == date(2005,Jun,14));
-
+ check_equal("Multiple literal '%'s in date format", d, date(2005,Jun,14));
+
     f->month_format("%%b %b");
     ss.str("%b Jun");
     ss >> m;
- check("Literal '%' in month format", m == greg_month(6));
+ check_equal("Literal '%' in month format", m, greg_month(6));
     f->month_format("%%%b");
     ss.str("%Jun");
     ss >> m;
- check("Multiple literal '%'s in month format", m == greg_month(6));
-
+ check_equal("Multiple literal '%'s in month format", m, greg_month(6));
+
     f->weekday_format("%%a %a");
     ss.str("%a Tue");
     ss >> gw;
- check("Literal '%' in weekday format", gw == greg_weekday(2));
+ check_equal("Literal '%' in weekday format", gw, greg_weekday(2));
     f->weekday_format("%%%a");
     ss.str("%Tue");
     ss >> gw;
- check("Multiple literal '%'s in weekday format", gw == greg_weekday(2));
-
+ check_equal("Multiple literal '%'s in weekday format", gw, greg_weekday(2));
+
     f->year_format("%%Y %Y");
     ss.str("%Y 2005");
     ss >> y;
- check("Literal '%' in year format", y == greg_year(2005));
+ check_equal("Literal '%' in year format", y, greg_year(2005));
     f->year_format("%%%Y");
     ss.str("%2005");
     ss >> y;
- check("Multiple literal '%'s in year format", y == greg_year(2005));
+ check_equal("Multiple literal '%'s in year format", y, greg_year(2005));
   }
 
   // All days, month, weekday, day, and year formats have been tested
@@ -219,22 +219,22 @@
   facet->set_iso_extended_format();
   iss.str("2005-01-15");
   iss >> d;
- check("ISO Extended format date", d == date(2005,Jan,15));
+ check_equal("ISO Extended format date", d, date(2005,Jan,15));
 
   facet->format("%B %d, %Y");
   iss.str("March 15, 2006");
   iss >> d;
- check("Custom date format: \"%B %d, %Y\" => 'March 15, 2006'",
- d == date(2006,Mar,15));
+ check_equal("Custom date format: \"%B %d, %Y\" => 'March 15, 2006'",
+ d, date(2006,Mar,15));
 
   facet->format("%Y-%j"); // Ordinal format ISO8601(2000 sect 5.2.2.1 extended)
   iss.str("2006-074");
   iss >> d;
- check("Custom date format: \"%Y-%j\" => '2006-074'",
- d == date(2006,Mar,15));
- check("Bad input Custom date format: \"%Y-%j\" => '2006-74' (w/exceptions)",
+ check_equal("Custom date format: \"%Y-%j\" => '2006-074'",
+ d, date(2006,Mar,15));
+ check("Bad input Custom date format: \"%Y-%j\" => '2006-74' (w/exceptions)",
       failure_test(d, "2006-74", e_bad_day_of_year, facet));
- check("Bad input Custom date format: \"%Y-%j\" => '2006-74' (no exceptions)",
+ check("Bad input Custom date format: \"%Y-%j\" => '2006-74' (no exceptions)",
       failure_test(d, "2006-74", facet));
 
   // date_period tests
@@ -250,7 +250,7 @@
   iss.str("[2002-07-04/2002-07-24]");
   facet->set_iso_extended_format();
   iss >> dp;
- check("Default period (closed range)", dp == date_period(begin,len));
+ check_equal("Default period (closed range)", dp, date_period(begin,len));
   {
     std::stringstream ss;
     date d(not_a_date_time);
@@ -262,32 +262,32 @@
     date_period dp3(d3, d4);
     ss << dp;
     ss >> dp2;
- check("Special values period (reversibility test)", dp == dp2);
+ check_equal("Special values period (reversibility test)", dp, dp2);
     ss.str("[-infinity/+infinity]");
     ss >> dp2;
- check("Special values period (infinities)", dp3 == dp2);
+ check_equal("Special values period (infinities)", dp3, dp2);
   }
-
+
 
   // open range
   period_parser pp(period_parser::AS_OPEN_RANGE);
   iss.str("[2002-07-04/2002-07-25)");
   facet->period_parser(pp);
   iss >> dp;
- check("Open range period", dp == date_period(begin,len));
+ check_equal("Open range period", dp, date_period(begin,len));
   // custom period delimiters
   pp.delimiter_strings(" to ", "from ", " exclusive", " inclusive");
   iss.str("from 2002-07-04 to 2002-07-25 exclusive");
   facet->period_parser(pp);
   iss >> dp;
- check("Open range period - custom delimiters", dp == date_period(begin,len));
+ check_equal("Open range period - custom delimiters", dp, date_period(begin,len));
   pp.range_option(period_parser::AS_CLOSED_RANGE);
   iss.str("from 2002-07-04 to 2002-07-24 inclusive");
   facet->period_parser(pp);
   iss >> dp;
- check("Closed range period - custom delimiters", dp == date_period(begin,len));
+ check_equal("Closed range period - custom delimiters", dp, date_period(begin,len));
+
 
-
   // date_generator tests
 
   // date_generators use formats contained in the
@@ -304,30 +304,30 @@
   first_kday_after fka(Sunday);
   // using default date_generator_parser "nth_strings"
   iss.str("29 Feb");
- iss >> pd;
+ iss >> pd;
   // Feb-29 is a valid date_generator, get_date() will fail in a non-leap year
- check("Default strings, partial_date",
- pd.get_date(2004) == date(2004,Feb,29));
+ check_equal("Default strings, partial_date",
+ pd.get_date(2004), date(2004,Feb,29));
   iss.str("second Mon of Mar");
   iss >> nkd;
- check("Default strings, nth_day_of_the_week_in_month",
- nkd.get_date(2004) == date(2004,Mar,8));
+ check_equal("Default strings, nth_day_of_the_week_in_month",
+ nkd.get_date(2004), date(2004,Mar,8));
   iss.str("first Tue of Apr");
- iss >> fkd;
- check("Default strings, first_day_of_the_week_in_month",
- fkd.get_date(2004) == date(2004,Apr,6));
+ iss >> fkd;
+ check_equal("Default strings, first_day_of_the_week_in_month",
+ fkd.get_date(2004), date(2004,Apr,6));
   iss.str("last Wed of May");
- iss >> lkd;
- check("Default strings, last_day_of_the_week_in_month",
- lkd.get_date(2004) == date(2004,May,26));
+ iss >> lkd;
+ check_equal("Default strings, last_day_of_the_week_in_month",
+ lkd.get_date(2004), date(2004,May,26));
   iss.str("Thu before");
- iss >> fkb;
- check("Default strings, first_day_of_the_week_before",
- fkb.get_date(date(2004,Feb,8)) == date(2004,Feb,5));
+ iss >> fkb;
+ check_equal("Default strings, first_day_of_the_week_before",
+ fkb.get_date(date(2004,Feb,8)), date(2004,Feb,5));
   iss.str("Fri after");
- iss >> fka;
- check("Default strings, first_day_of_the_week_after",
- fka.get_date(date(2004,Feb,1)) == date(2004,Feb,6));
+ iss >> fka;
+ check_equal("Default strings, first_day_of_the_week_after",
+ fka.get_date(date(2004,Feb,1)), date(2004,Feb,6));
   // failure tests
   check("Incorrect elements (date_generator) w/exceptions", // after/before type mixup
       failure_test(fkb, "Fri after", e_failure, new date_input_facet()));
@@ -337,73 +337,73 @@
       failure_test(lkd, "first Tue of Apr", e_failure, new date_input_facet()));
   check("Incorrect elements (date_generator) no exceptions", // first/last type mixup
       failure_test(lkd, "first Tue of Apr", new date_input_facet()));
- check("Incorrect elements (date_generator) w/exceptions", // 'in' is wrong
+ check("Incorrect elements (date_generator) w/exceptions", // 'in' is wrong
       failure_test(nkd, "second Mon in Mar", e_failure, new date_input_facet()));
- check("Incorrect elements (date_generator) no exceptions", // 'in' is wrong
+ check("Incorrect elements (date_generator) no exceptions", // 'in' is wrong
       failure_test(nkd, "second Mon in Mar", new date_input_facet()));
 
   // date_generators - custom element strings
   facet->date_gen_element_strings("1st","2nd","3rd","4th","5th","final","prior to","past","in");
   iss.str("3rd Sat in Jul");
   iss >> nkd;
- check("Custom strings, nth_day_of_the_week_in_month",
- nkd.get_date(2004) == date(2004,Jul,17));
+ check_equal("Custom strings, nth_day_of_the_week_in_month",
+ nkd.get_date(2004), date(2004,Jul,17));
   iss.str("1st Wed in May");
- iss >> fkd;
- check("Custom strings, first_day_of_the_week_in_month",
- fkd.get_date(2004) == date(2004,May,5));
+ iss >> fkd;
+ check_equal("Custom strings, first_day_of_the_week_in_month",
+ fkd.get_date(2004), date(2004,May,5));
   iss.str("final Tue in Apr");
- iss >> lkd;
- check("Custom strings, last_day_of_the_week_in_month",
- lkd.get_date(2004) == date(2004,Apr,27));
+ iss >> lkd;
+ check_equal("Custom strings, last_day_of_the_week_in_month",
+ lkd.get_date(2004), date(2004,Apr,27));
   iss.str("Fri prior to");
- iss >> fkb;
- check("Custom strings, first_day_of_the_week_before",
- fkb.get_date(date(2004,Feb,8)) == date(2004,Feb,6));
+ iss >> fkb;
+ check_equal("Custom strings, first_day_of_the_week_before",
+ fkb.get_date(date(2004,Feb,8)), date(2004,Feb,6));
   iss.str("Thu past");
- iss >> fka;
- check("Custom strings, first_day_of_the_week_after",
- fka.get_date(date(2004,Feb,1)) == date(2004,Feb,5));
+ iss >> fka;
+ check_equal("Custom strings, first_day_of_the_week_after",
+ fka.get_date(date(2004,Feb,1)), date(2004,Feb,5));
 
   // date_generators - special case with empty element string
   /* Doesn't work. Empty string returns -1 from string_parse_tree
    * because it attempts to match the next set of characters in the
    * stream to the wrong element. Ex. It attempts to match "Mar" to
    * the 'of' element in the test below.
- *
+ *
   facet->date_gen_element_strings("1st","2nd","3rd","4th","5th","final","prior to","past",""); // the 'of' string is an empty string
   iss.str("final Mon Mar");
- iss >> lkd;
- check("Special case, empty element string",
- lkd.get_date(2005) == date(2005,Mar,28));
+ iss >> lkd;
+ check_equal("Special case, empty element string",
+ lkd.get_date(2005), date(2005,Mar,28));
       */
-
+
 
   // special values tests (date and days only)
   iss.str("minimum-date-time +infinity");
   iss >> d;
   iss >> dd;
- check("Special values, default strings, min_date_time date",
- d == date(min_date_time));
- check("Special values, default strings, pos_infin days",
- dd == days(pos_infin));
+ check_equal("Special values, default strings, min_date_time date",
+ d, date(min_date_time));
+ check_equal("Special values, default strings, pos_infin days",
+ dd, days(pos_infin));
   iss.str("-infinity maximum-date-time");
   iss >> d;
   iss >> dd;
- check("Special values, default strings, neg_infin date",
- d == date(neg_infin));
- check("Special values, default strings, max_date_time days",
- dd == days(max_date_time));
+ check_equal("Special values, default strings, neg_infin date",
+ d, date(neg_infin));
+ check_equal("Special values, default strings, max_date_time days",
+ dd, days(max_date_time));
   iss.str("not-a-date-time");
   iss >> d;
- check("Special values, default strings, not_a_date_time date",
- d == date(not_a_date_time));
+ check_equal("Special values, default strings, not_a_date_time date",
+ d, date(not_a_date_time));
 
   // in addition check that special_value_from_string also works correctly for other special values
- check("Special values, default strings, not_special test",
- special_value_from_string("not_special") == not_special);
- check("Special values, default strings, junk test",
- special_value_from_string("junk") == not_special);
+ check_equal("Special values, default strings, not_special test",
+ special_value_from_string("not_special"), not_special);
+ check_equal("Special values, default strings, junk test",
+ special_value_from_string("junk"), not_special);
 
   // special values custom, strings
   special_values_parser svp("NADT", "MINF", "INF", "MINDT", "MAXDT");
@@ -411,33 +411,33 @@
   iss.str("MINDT INF");
   iss >> d;
   iss >> dd;
- check("Special values, custom strings, min_date_time date",
- d == date(min_date_time));
- check("Special values, custom strings, pos_infin days",
- dd == days(pos_infin));
+ check_equal("Special values, custom strings, min_date_time date",
+ d, date(min_date_time));
+ check_equal("Special values, custom strings, pos_infin days",
+ dd, days(pos_infin));
   iss.str("MINF MAXDT");
   iss >> d;
   iss >> dd;
- check("Special values, custom strings, neg_infin date",
- d == date(neg_infin));
- check("Special values, custom strings, max_date_time days",
- dd == days(max_date_time));
+ check_equal("Special values, custom strings, neg_infin date",
+ d, date(neg_infin));
+ check_equal("Special values, custom strings, max_date_time days",
+ dd, days(max_date_time));
   iss.str("NADT");
   iss >> dd;
- check("Special values, custom strings, not_a_date_time days",
- dd == days(not_a_date_time));
+ check_equal("Special values, custom strings, not_a_date_time days",
+ dd, days(not_a_date_time));
   // failure test
- check("Misspelled input, special_value date w/exceptions",
+ check("Misspelled input, special_value date w/exceptions",
       failure_test(d, "NSDT", e_bad_year, new date_input_facet()));
- check("Misspelled input, special_value date no exceptions",
+ check("Misspelled input, special_value date no exceptions",
       failure_test(d, "NSDT", new date_input_facet()));
- check("Misspelled input, special_value days w/exceptions",
+ check("Misspelled input, special_value days w/exceptions",
       failure_test(dd, "NSDT", e_failure, new date_input_facet()));
- check("Misspelled input, special_value days no exceptions",
+ check("Misspelled input, special_value days no exceptions",
       failure_test(dd, "NSDT", new date_input_facet()));
 
   {
- // German names. Please excuse any errors, I don't speak German and
+ // German names. Please excuse any errors, I don't speak German and
     // had to rely on an on-line translation service.
     // These tests check one of each (at least) from all sets of custom strings
 
@@ -460,7 +460,7 @@
     wkdays_abbrev.assign(w_a, w_a+7);
     wkdays_full.assign(w_f, w_f+7);
     date_parser d_parser("%B %d %Y",
- months_abbrev, months_full,
+ months_abbrev, months_full,
                          wkdays_abbrev, wkdays_full);
 
     // create a special_values parser
@@ -478,7 +478,7 @@
                               "Fünft","Letzt","Vor","Nach","Von");
 
     // create the date_input_facet
- date_input_facet* de_facet =
+ date_input_facet* de_facet =
       new date_input_facet("%B %d %Y",
                            d_parser,
                            sv_parser,
@@ -490,25 +490,25 @@
     iss.str("Juni 06 2005 Dez Wenigstes Datum Die");
     iss >> d;
     iss >> m;
- check("German names: date", d == date(2005, Jun, 6));
- check("German names: month", m == greg_month(Dec));
+ check_equal("German names: date", d, date(2005, Jun, 6));
+ check_equal("German names: month", m, greg_month(Dec));
     iss >> d;
     iss >> gw;
- check("German names: special value date", d == date(min_date_time));
- check("German names: short weekday", gw == greg_weekday(Tuesday));
+ check_equal("German names: special value date", d, date(min_date_time));
+ check_equal("German names: short weekday", gw, greg_weekday(Tuesday));
     de_facet->weekday_format("%A"); // long weekday
     // Tuesday, Second Tuesday of Mar
     iss.str("Dienstag Zweitens Dienstag von Mar");
     iss >> gw;
     iss >> nkd;
- check("German names: long weekday", gw == greg_weekday(Tuesday));
- check("German names, nth_day_of_the_week_in_month",
- nkd.get_date(2005) == date(2005,Mar,8));
+ check_equal("German names: long weekday", gw, greg_weekday(Tuesday));
+ check_equal("German names, nth_day_of_the_week_in_month",
+ nkd.get_date(2005), date(2005,Mar,8));
     // Tuesday after
     iss.str("Dienstag Nach");
- iss >> fka;
- check("German names, first_day_of_the_week_after",
- fka.get_date(date(2005,Apr,5)) == date(2005,Apr,12));
+ iss >> fka;
+ check_equal("German names, first_day_of_the_week_after",
+ fka.get_date(date(2005,Apr,5)), date(2005,Apr,12));
   }
 
   {
@@ -525,25 +525,25 @@
                                           "**October**","**November**","**December**"};
     const char* const weekday_short_names[]={"day1", "day2","day3","day4",
                                              "day5","day6","day7"};
- const char* const weekday_long_names[]= {"Sun-0", "Mon-1", "Tue-2",
- "Wed-3", "Thu-4",
+ const char* const weekday_long_names[]= {"Sun-0", "Mon-1", "Tue-2",
+ "Wed-3", "Thu-4",
                                              "Fri-5", "Sat-6"};
 
     std::vector<std::basic_string<char> > short_weekday_names;
     std::vector<std::basic_string<char> > long_weekday_names;
     std::vector<std::basic_string<char> > short_month_names;
     std::vector<std::basic_string<char> > long_month_names;
-
- std::copy(&weekday_short_names[0],
+
+ std::copy(&weekday_short_names[0],
               &weekday_short_names[7],
               std::back_inserter(short_weekday_names));
- std::copy(&weekday_long_names[0],
+ std::copy(&weekday_long_names[0],
               &weekday_long_names[7],
               std::back_inserter(long_weekday_names));
- std::copy(&month_short_names[0],
+ std::copy(&month_short_names[0],
               &month_short_names[12],
               std::back_inserter(short_month_names));
- std::copy(&month_long_names[0],
+ std::copy(&month_long_names[0],
               &month_long_names[12],
               std::back_inserter(long_month_names));
 
@@ -558,20 +558,20 @@
     facet->format("%a %b %d, %Y");
     ss.str("day7 *apr* 23, 2005");
     ss >> d;
- check("Short custom names, set via accessor function", d.day_of_week() == greg_weekday(6));
- check("Short custom names, set via accessor function", d.month() == greg_month(4));
+ check_equal("Short custom names, set via accessor function", d.day_of_week(), greg_weekday(6));
+ check_equal("Short custom names, set via accessor function", d.month(), greg_month(4));
     ss.str("");
     ss.str("Sun-0 **April** 24, 2005");
     facet->format("%A %B %d, %Y");
     ss >> d;
- check("Long custom names, set via accessor function", d.day_of_week() == greg_weekday(0));
- check("Long custom names, set via accessor function", d.month() == greg_month(4));
+ check_equal("Long custom names, set via accessor function", d.day_of_week(), greg_weekday(0));
+ check_equal("Long custom names, set via accessor function", d.month(), greg_month(4));
 
   }
 #else
- check("This test is a nop for platforms with USE_DATE_TIME_PRE_1_33_FACET_IO",
+ check("This test is a nop for platforms with USE_DATE_TIME_PRE_1_33_FACET_IO",
           true);
 #endif
   return printTestStats();
 }
-
+

Modified: branches/release/libs/date_time/test/gregorian/testformat_date_parser.cpp
==============================================================================
--- branches/release/libs/date_time/test/gregorian/testformat_date_parser.cpp (original)
+++ branches/release/libs/date_time/test/gregorian/testformat_date_parser.cpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -66,7 +66,7 @@
 void
 wtest_format(const std::basic_string<wchar_t>& format,
              const std::basic_string<wchar_t>& value,
- const std::string testname,
+ const std::string& testname,
              boost::gregorian::date expected_res)
 {
   typedef boost::date_time::format_date_parser<date, wchar_t> parser_type;
@@ -75,19 +75,18 @@
   try {
     // string_type format(format);
     std::basic_stringstream<wchar_t> ws;
- ws << value;
+ ws << value;
     iter_type sitr(ws);
     iter_type stream_end;
-
+
     parser_type p(format, wshort_month_names, wlong_month_names,
                   wshort_week_names, wlong_week_names);
     date d = p.parse_date(sitr, stream_end, format);
- check(testname, d == expected_res);
+ check_equal(testname, d, expected_res);
   }
   catch(std::exception& e) {
     std::cout << "Got an exception: " << e.what() << std::endl;
     check(testname, false);
-
   }
 }
 
@@ -95,7 +94,7 @@
 void
 test_format(const std::basic_string<char>& format,
             const std::basic_string<char>& value,
- const std::string testname,
+ const std::string& testname,
             boost::gregorian::date expected_res)
 {
   typedef boost::date_time::format_date_parser<date, char> parser_type;
@@ -107,16 +106,15 @@
     ws << value;
     iter_type sitr(ws);
     iter_type stream_end;
-
+
     parser_type pt(format, short_month_names, long_month_names,
                    short_week_names, long_week_names);
     date d = pt.parse_date(sitr, stream_end, format);
- check(testname, d == expected_res);
+ check_equal(testname, d, expected_res);
   }
   catch(std::exception& e) {
     std::cout << "Got an exception: " << e.what() << std::endl;
     check(testname, false);
-
   }
 }
 
@@ -126,24 +124,22 @@
 test_format2(boost::date_time::format_date_parser<date, charT>& parser,
              const charT* const format,
              const charT* const value,
- const std::string testname,
+ const std::string& testname,
              boost::gregorian::date expected_res)
 {
   try {
     date d = parser.parse_date(value, format);
- check(testname, d == expected_res);
+ check_equal(testname, d == expected_res);
   }
   catch(std::exception& e) {
     std::cout << "Got an exception: " << e.what() << std::endl;
     check(testname, false);
-
   }
 }
 
 int
 main()
 {
-
   std::copy(&wmonth_short_names[0],
             &wmonth_short_names[12],
             std::back_inserter(wshort_month_names));
@@ -231,15 +227,15 @@
                "%A %B %d, %Y", date(2004,3,15));
 
   // bad format case...
-
- {
+
+ {
     try {
       std::wstring format(L"%Y-%d");
       std::wstringstream ws;
       ws << L"2004-12-31";
       std::istreambuf_iterator<wchar_t> sitr(ws);
       std::istreambuf_iterator<wchar_t> stream_end;
-
+
       boost::date_time::format_date_parser<date,wchar_t> pt(format,
                                                             wshort_month_names,
                                                             wlong_month_names,
@@ -359,7 +355,7 @@
                  "long strings from locale", date(2004,Nov,1));
     test_format2(parser, "%A %B %d, %Y", "thursday december 31, 2004",
                  "long strings from locale", date(2004,Dec,31));
-
+
   }
 
   return printTestStats();

Modified: branches/release/libs/date_time/test/posix_time/testtime_input_facet.cpp
==============================================================================
--- branches/release/libs/date_time/test/posix_time/testtime_input_facet.cpp (original)
+++ branches/release/libs/date_time/test/posix_time/testtime_input_facet.cpp 2009-06-04 04:24:49 EDT (Thu, 04 Jun 2009)
@@ -96,25 +96,25 @@
   iss >> td;
   iss >> pt;
 #if defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG)
- check("Default format time_duration", td == time_duration(9,59,1,321987654));
- check("Default format ptime", pt == ptime(date(2005,01,15),time_duration(10,15,3,123456789)));
+ check_equal("Default format time_duration", td, time_duration(9,59,1,321987654));
+ check_equal("Default format ptime", pt, ptime(date(2005,01,15),time_duration(10,15,3,123456789)));
 #else
- check("Default format time_duration", td == time_duration(9,59,1,321987));
- check("Default format ptime", pt == ptime(date(2005,01,15),time_duration(10,15,3,123456)));
+ check_equal("Default format time_duration", td, time_duration(9,59,1,321987));
+ check_equal("Default format ptime", pt, ptime(date(2005,01,15),time_duration(10,15,3,123456)));
 #endif
 
   // test all flags that appear in time_input_facet
   iss.str("12:34:56 2005-Jan-15 12:34:56");
   iss >> td;
   iss >> pt;
- check("Default format time_duration no frac_sec", td == time_duration(12,34,56));
+ check_equal("Default format time_duration no frac_sec", td, time_duration(12,34,56));
   // the following test insures %F parsing stops at the appropriate point
- check("Default format ptime", pt == ptime(date(2005,01,15),time_duration(12,34,56)));
-
+ check_equal("Default format ptime", pt, ptime(date(2005,01,15),time_duration(12,34,56)));
+
   iss.str("14:13:12 extra stuff"); // using default %H:%M:%S%F format
   iss >> td;
- check("Default frac_sec format time_duration", td == time_duration(14,13,12));
-
+ check_equal("Default frac_sec format time_duration", td, time_duration(14,13,12));
+
   time_input_facet* facet = new time_input_facet();
   std::locale loc(std::locale::classic(), facet);
   facet->time_duration_format("%H:%M:%S%f");
@@ -122,61 +122,61 @@
 
   iss.str("14:13:12.0 extra stuff");
   iss >> td;
- check("Required-frac_sec format time_duration", td == time_duration(14,13,12));
+ check_equal("Required-frac_sec format time_duration", td, time_duration(14,13,12));
 
   iss.str("12");
   facet->time_duration_format("%H");
   iss >> td;
- check("Hours format", td == hours(12));
+ check_equal("Hours format", td, hours(12));
 
   iss.str("05");
   facet->time_duration_format("%M");
   iss >> td;
- check("Minutes format", td == minutes(5));
+ check_equal("Minutes format", td, minutes(5));
 
   iss.str("45");
   facet->time_duration_format("%S");
   iss >> td;
- check("Seconds w/o frac_sec format", td == seconds(45));
+ check_equal("Seconds w/o frac_sec format", td, seconds(45));
 
   iss.str("10.01");
   facet->time_duration_format("%s");
   iss >> td;
 #if defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG)
- check("Seconds w/ frac_sec format", td == time_duration(0,0,10,10000000));
+ check_equal("Seconds w/ frac_sec format", td, time_duration(0,0,10,10000000));
 #else
- check("Seconds w/ frac_sec format", td == time_duration(0,0,10,10000));
+ check_equal("Seconds w/ frac_sec format", td, time_duration(0,0,10,10000));
 #endif
-
+
   iss.str("2005-105T23:59");
   facet->format("%Y-%jT%H:%M"); // extended ordinal format
   iss >> pt;
- check("Extended Ordinal format", pt == ptime(date(2005,4,15),time_duration(23,59,0)));
+ check_equal("Extended Ordinal format", pt, ptime(date(2005,4,15),time_duration(23,59,0)));
 
   /* this is not implemented yet. The flags: %I & %p are not parsed
   iss.str("2005-Jun-14 03:15:00 PM");
   facet->format("%Y-%b-%d %I:%M:%S %p");
   iss >> pt;
- check("12 hour time format (AM/PM)", pt == ptime(date(2005,6,14),time_duration(15,15,0)));
+ check_equal("12 hour time format (AM/PM)", pt, ptime(date(2005,6,14),time_duration(15,15,0)));
   */
 
   iss.str("2005-Jun-14 15:15:00 %d");
   facet->format("%Y-%b-%d %H:%M:%S %%d");
   iss >> pt;
- check("Literal '%' in format", pt == ptime(date(2005,6,14),time_duration(15,15,0)));
+ check_equal("Literal '%' in format", pt, ptime(date(2005,6,14),time_duration(15,15,0)));
   iss.str("15:15:00 %d");
   facet->time_duration_format("%H:%M:%S %%d");
   iss >> td;
- check("Literal '%' in time_duration format", td == time_duration(15,15,0));
+ check_equal("Literal '%' in time_duration format", td, time_duration(15,15,0));
   iss.str("2005-Jun-14 15:15:00 %14");
   facet->format("%Y-%b-%d %H:%M:%S %%%d"); // %% => % & %d => day_of_month
   iss >> pt;
- check("Multiple literal '%'s in format", pt == ptime(date(2005,6,14),time_duration(15,15,0)));
+ check_equal("Multiple literal '%'s in format", pt, ptime(date(2005,6,14),time_duration(15,15,0)));
   iss.str("15:15:00 %15");
   facet->time_duration_format("%H:%M:%S %%%M");
   iss >> td;
- check("Multiple literal '%'s in time_duration format", td == time_duration(15,15,0));
-
+ check_equal("Multiple literal '%'s in time_duration format", td, time_duration(15,15,0));
+
   { /****** iso format tests (and custom 'scrunched-together formats) ******/
     time_input_facet *facet = new time_input_facet();
     facet->set_iso_format();
@@ -195,21 +195,21 @@
 
     ss.str("20021017T231217.12345");
     ss >> pt;
- check("iso_format ptime", pt == result);
+ check_equal("iso_format ptime", pt, result);
     ss.str("");
     facet->set_iso_extended_format();
     ss.str("2002-10-17 23:12:17.12345");
     ss >> pt;
- check("iso_extended_format ptime", pt == result);
+ check_equal("iso_extended_format ptime", pt, result);
     ss.str("");
     ss.str("231217.12345");
     ss >> td;
- check("iso_format time_duration", td == td2);
+ check_equal("iso_format time_duration", td, td2);
     ss.str("");
     ss.str("-infinity");
     ss >> td;
- check("iso_format time_duration (special_value)",
- td == time_duration(neg_infin));
+ check_equal("iso_format time_duration (special_value)",
+ td, time_duration(neg_infin));
     ss.str("");
     // the above tests prove correct parsing of time values in these formats.
     // these tests show they also handle special_values & exceptions properly
@@ -221,34 +221,34 @@
       ss.str("not-a-date-time");
       ++count;
       ss >> td;
- check("special value w/ hours flag", td == nadt);
+ check_equal("special value w/ hours flag", td, nadt);
       ss.str("");
       facet->time_duration_format("%M%S%F");
       ss.str("not-a-date-time");
       ++count;
       ss >> td;
- check("special value w/ minutes flag", td == nadt);
+ check_equal("special value w/ minutes flag", td, nadt);
       ss.str("");
       facet->time_duration_format("%S%F");
       ss.str("not-a-date-time");
       ++count;
       ss >> td;
- check("special value w/ seconds flag", td == nadt);
+ check_equal("special value w/ seconds flag", td, nadt);
       ss.str("");
       facet->time_duration_format("%s");
       ss.str("not-a-date-time");
       ++count;
       ss >> td;
- check("special value w/ sec w/frac_sec (always) flag", td == nadt);
+ check_equal("special value w/ sec w/frac_sec (always) flag", td, nadt);
       ss.str("");
       facet->time_duration_format("%f");
       ss.str("not-a-date-time");
       ++count;
       ss >> td;
- check("special value w/ frac_sec (always) flag", td == nadt);
+ check_equal("special value w/ frac_sec (always) flag", td, nadt);
       ss.str("");
     }
- catch(...) {
+ catch(...) {
       // any exception is a failure
       std::stringstream msg;
       msg << "special_values with scrunched formats failed at test" << count;
@@ -276,7 +276,7 @@
         failure_test(td, "bad_input", exc, new time_input_facet("%f")));
     check("silent failure test w/ frac_sec flag",
         failure_test(td, "bad_input", new time_input_facet("%f")));
-
+
   }
   // special_values tests. prove the individual flags catch special_values
   // NOTE: these flags all by themselves will not parse a complete ptime,
@@ -286,41 +286,41 @@
   facet->time_duration_format("%H");
   iss >> pt;
   iss >> td;
- check("Special value: ptime %H flag", pt == ptime(pos_infin));
- check("Special value: time_duration %H flag", td == time_duration(neg_infin));
-
+ check_equal("Special value: ptime %H flag", pt, ptime(pos_infin));
+ check_equal("Special value: time_duration %H flag", td, time_duration(neg_infin));
+
   iss.str("not-a-date-time +infinity");
   facet->format("%M");
   facet->time_duration_format("%M");
   iss >> pt;
   iss >> td;
- check("Special value: ptime %M flag", pt == ptime(not_a_date_time));
- check("Special value: time_duration %M flag", td == time_duration(pos_infin));
-
+ check_equal("Special value: ptime %M flag", pt, ptime(not_a_date_time));
+ check_equal("Special value: time_duration %M flag", td, time_duration(pos_infin));
+
   iss.str("-infinity not-a-date-time ");
   facet->format("%S");
   facet->time_duration_format("%S");
   iss >> pt;
   iss >> td;
- check("Special value: ptime %S flag", pt == ptime(neg_infin));
- check("Special value: time_duration %S flag", td == time_duration(not_a_date_time));
-
+ check_equal("Special value: ptime %S flag", pt, ptime(neg_infin));
+ check_equal("Special value: time_duration %S flag", td, time_duration(not_a_date_time));
+
   iss.str("+infinity -infinity");
   facet->format("%s");
   facet->time_duration_format("%s");
   iss >> pt;
   iss >> td;
- check("Special value: ptime %s flag", pt == ptime(pos_infin));
- check("Special value: time_duration %s flag", td == time_duration(neg_infin));
-
+ check_equal("Special value: ptime %s flag", pt, ptime(pos_infin));
+ check_equal("Special value: time_duration %s flag", td, time_duration(neg_infin));
+
   iss.str("not-a-date-time +infinity");
   facet->format("%j");
   facet->time_duration_format("%f");
   iss >> pt;
   iss >> td;
- check("Special value: ptime %j flag", pt == ptime(not_a_date_time));
- check("Special value: time_duration %f flag", td == time_duration(pos_infin));
-
+ check_equal("Special value: ptime %j flag", pt, ptime(not_a_date_time));
+ check_equal("Special value: time_duration %f flag", td, time_duration(pos_infin));
+
   // time_period tests - the time_period_parser is thoroughly tested in gregorian tests
   // default period format is closed range so last ptime is included in peiod
   iss.str("[2005-Jan-01 00:00:00/2005-Dec-31 23:59:59]");
@@ -341,21 +341,21 @@
     time_period tp3(pt3, pt4);
     ss << tp;
     ss >> tp2;
- check("Special values period (reversibility test)", tp == tp2);
+ check_equal("Special values period (reversibility test)", tp, tp2);
     ss.str("[-infinity/+infinity]");
     ss >> tp2;
- check("Special values period (infinities)", tp3 == tp2);
+ check_equal("Special values period (infinities)", tp3, tp2);
   }
 
   // Failure tests
   // faliure tests for date elements tested in gregorian tests
   time_input_facet* facet2 = new time_input_facet();
   facet2->time_duration_format("%H:%M:%S%f");
- check("Failure test: Missing frac_sec with %f flag (w/exceptions)",
+ check("Failure test: Missing frac_sec with %f flag (w/exceptions)",
         failure_test(td, "14:13:12 extra stuff", e_failure, facet2));
   time_input_facet* facet3 = new time_input_facet();
   facet3->time_duration_format("%H:%M:%S%f");
- check("Failure test: Missing frac_sec with %f flag (no exceptions)",
+ check("Failure test: Missing frac_sec with %f flag (no exceptions)",
         failure_test(td, "14:13:12 extra stuff", facet3));
 
   // Reversable format tests
@@ -370,22 +370,22 @@
   ss.str("");
   ss << pt_io; // stream out pt_io
   ss >> pt;
- check("Stream out one ptime then into another: default format", pt_io == pt);
+ check_equal("Stream out one ptime then into another: default format", pt_io, pt);
   ss.str("");
   ss << td_io; // stream out td_io
   ss >> td;
- check("Stream out one time_duration then into another: default format", td_io == td);
+ check_equal("Stream out one time_duration then into another: default format", td_io, td);
 
   td_io = time_duration(1,29,59); // no frac_sec, default format has %F
   pt_io = ptime(date(2004,2,29), td_io); // leap year
   ss.str("");
   ss << pt_io; // stream out pt_io
   ss >> pt;
- check("Stream out one ptime then into another: default format", pt_io == pt);
+ check_equal("Stream out one ptime then into another: default format", pt_io, pt);
   ss.str("");
   ss << td_io; // stream out td_io
   ss >> td;
- check("Stream out one time_duration then into another: default format", td_io == td);
+ check_equal("Stream out one time_duration then into another: default format", td_io, td);
 
   td_io = time_duration(13,05,0); // no seconds as the next formats won't use them
   pt_io = ptime(date(2004,2,29), td_io); // leap year
@@ -394,14 +394,14 @@
   ss.str("");
   ss << pt_io; // stream out pt_io
   ss >> pt;
- check("Stream out one ptime then into another: extended ordinal format", pt_io == pt);
+ check_equal("Stream out one ptime then into another: extended ordinal format", pt_io, pt);
 
   otp_facet->format("Time: %H:%M, Date: %B %d, %Y"); // custom format with extra words
   inp_facet->format("Time: %H:%M, Date: %B %d, %Y");
   ss.str("");
   ss << pt_io; // stream out pt_io
   ss >> pt;
- check("Stream out one ptime then into another: custom format (" + ss.str() + ")", pt_io == pt);
+ check_equal("Stream out one ptime then into another: custom format (" + ss.str() + ")", pt_io, pt);
 
   {
     // fully parameterized constructor - compile only test, all other features tested in gregorian
@@ -411,7 +411,7 @@
     boost::date_time::date_generator_parser<date, char> dgp; // default constructor
     time_input_facet tif("%Y-%m-%d %H:%M:%s", fdp, svp, pp, dgp);
   }
-#endif // USE_DATE_TIME_PRE_1_33_FACET_IO
+#endif // USE_DATE_TIME_PRE_1_33_FACET_IO
 
 }
 
@@ -432,4 +432,4 @@
   }
   return printTestStats();
 }
-
+


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