diff --git a/.gitignore b/.gitignore index d045781..0e92457 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -**/time_duration_serialization.* **/test_facet_file.out +**/time_duration_serialization.* diff --git a/doc/build.jam b/doc/build.jam index 14b3dde..529cb8a 100644 --- a/doc/build.jam +++ b/doc/build.jam @@ -4,8 +4,6 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -project libs/date_time/doc ; - ############################################################################### alias boostdoc : ../xmldoc/date_time.xml diff --git a/example/gregorian/find_last_day_of_months.cpp b/example/gregorian/find_last_day_of_months.cpp index 3d082fc..9e59f20 100644 --- a/example/gregorian/find_last_day_of_months.cpp +++ b/example/gregorian/find_last_day_of_months.cpp @@ -15,7 +15,8 @@ main() // get a month and a year from the user try { - int y, m; + greg_year::value_type y; + greg_month::value_type m; std::cout << " Enter Year(ex: 2002): "; std::cin >> y; year = greg_year(y); diff --git a/example/gregorian/print_holidays.cpp b/example/gregorian/print_holidays.cpp index 0e1c946..2d2fa53 100644 --- a/example/gregorian/print_holidays.cpp +++ b/example/gregorian/print_holidays.cpp @@ -33,12 +33,12 @@ print_date(boost::gregorian::date d) int main() { - std::cout << "Enter Year: "; - int year; - std::cin >> year; - using namespace boost::gregorian; + std::cout << "Enter Year: "; + greg_year::value_type year; + std::cin >> year; + //define a collection of holidays fixed by month and day std::vector holidays; holidays.push_back(new partial_date(1,Jan)); //Western New Year diff --git a/example/gregorian/print_month.cpp b/example/gregorian/print_month.cpp index 1293f6e..34e741a 100644 --- a/example/gregorian/print_month.cpp +++ b/example/gregorian/print_month.cpp @@ -19,16 +19,18 @@ int main() { + using namespace boost::gregorian; + std::cout << "Enter Year: "; - int year, month; + greg_year::value_type year; + greg_month::value_type month; std::cin >> year; std::cout << "Enter Month(1..12): "; std::cin >> month; - using namespace boost::gregorian; try { //Use the calendar to get the last day of the month - int eom_day = gregorian_calendar::end_of_month_day(year,month); + greg_day::value_type eom_day = gregorian_calendar::end_of_month_day(year,month); date endOfMonth(year,month,eom_day); //construct an iterator starting with firt day of the month diff --git a/test/gregorian/testdate.cpp b/test/gregorian/testdate.cpp index 4f86e1d..41a9829 100644 --- a/test/gregorian/testdate.cpp +++ b/test/gregorian/testdate.cpp @@ -21,9 +21,9 @@ main() date def; check("Default constructor", def == date(not_a_date_time)); #endif - date d(2000,1,1); + date d1(1900,1,1); - date d2 = d; + date d2 = date(2000,1,1); date d3(d2); check("Copy constructor", d3 == d2); date d4(2000,12,31); @@ -276,7 +276,7 @@ main() } //converts to date and back -- should get same result - check_equal("tm conversion functions 2000-1-1", date_from_tm(to_tm(d)), d); + check_equal("tm conversion functions 2000-1-1", date_from_tm(to_tm(d2)), d2); check_equal("tm conversion functions 1900-1-1", date_from_tm(to_tm(d1)), d1); check_equal("tm conversion functions min date 1400-1-1 ", date_from_tm(to_tm(d14)), d14); check_equal("tm conversion functions max date 9999-12-31", date_from_tm(to_tm(d13)), d13); diff --git a/test/gregorian/testdate_facet_new.cpp b/test/gregorian/testdate_facet_new.cpp index 4718ac3..9c6dafb 100644 --- a/test/gregorian/testdate_facet_new.cpp +++ b/test/gregorian/testdate_facet_new.cpp @@ -358,12 +358,12 @@ int main() { // greg_month tests { - for(int i = 0; i < 12; ++i) { + for(greg_month::value_type i = 0; i < 12; ++i) { greg_month m(i+1); // month numbers 1-12 teststreaming("greg_month short", m, short_months[i], loc); } small_types_facet->month_format(L"%B"); // full name - for(int i = 0; i < 12; ++i) { + for(greg_month::value_type i = 0; i < 12; ++i) { greg_month m(i+1); // month numbers 1-12 teststreaming("greg_month full", m, full_months[i], loc); } @@ -371,12 +371,12 @@ int main() { // greg_weekday tests { - for(int i = 0; i < 7; ++i) { + for(greg_weekday::value_type i = 0; i < 7; ++i) { greg_weekday gw(i); // weekday numbers 0-6 teststreaming("greg_weekday short", gw, short_weekdays[i], loc); } small_types_facet->weekday_format(L"%A"); // full name - for(int i = 0; i < 7; ++i) { + for(greg_weekday::value_type i = 0; i < 7; ++i) { greg_weekday gw(i); // weekday numbers 0-6 teststreaming("greg_weekday full", gw, full_weekdays[i], loc); } diff --git a/test/gregorian/testdate_input_facet.cpp b/test/gregorian/testdate_input_facet.cpp index 1fee227..c52caa7 100644 --- a/test/gregorian/testdate_input_facet.cpp +++ b/test/gregorian/testdate_input_facet.cpp @@ -170,39 +170,39 @@ int main(){ failure_test(d,"2005071", e_bad_day_of_month, f2)); { // literal % in format tests - date d(not_a_date_time); - greg_month m(1); - greg_weekday gw(0); + date dx(not_a_date_time); + greg_month mx(1); + greg_weekday gwx(0); greg_year y(1400); 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_equal("Literal '%' in date format", d, date(2005,Jun,14)); + ss >> dx; + check_equal("Literal '%' in date format", dx, date(2005,Jun,14)); f->format("%%%d %Y-%b-%d"); ss.str("%14 2005-Jun-14"); - ss >> d; - check_equal("Multiple literal '%'s in date format", d, date(2005,Jun,14)); + ss >> dx; + check_equal("Multiple literal '%'s in date format", dx, date(2005,Jun,14)); f->month_format("%%b %b"); ss.str("%b Jun"); - ss >> m; - check_equal("Literal '%' in month format", m, greg_month(6)); + ss >> mx; + check_equal("Literal '%' in month format", mx, greg_month(6)); f->month_format("%%%b"); ss.str("%Jun"); - ss >> m; - check_equal("Multiple literal '%'s in month format", m, greg_month(6)); + ss >> mx; + check_equal("Multiple literal '%'s in month format", mx, greg_month(6)); f->weekday_format("%%a %a"); ss.str("%a Tue"); - ss >> gw; - check_equal("Literal '%' in weekday format", gw, greg_weekday(2)); + ss >> gwx; + check_equal("Literal '%' in weekday format", gwx, greg_weekday(2)); f->weekday_format("%%%a"); ss.str("%Tue"); - ss >> gw; - check_equal("Multiple literal '%'s in weekday format", gw, greg_weekday(2)); + ss >> gwx; + check_equal("Multiple literal '%'s in weekday format", gwx, greg_weekday(2)); f->year_format("%%Y %Y"); ss.str("%Y 2005"); @@ -258,16 +258,16 @@ int main(){ check_equal("Default period (closed range)", dp, date_period(begin,len)); { std::stringstream ss; - date d(not_a_date_time); + date dx(not_a_date_time); date d2 = day_clock::local_day(); date d3(neg_infin); date d4(pos_infin); - date_period dp(d2, d); // date/nadt - date_period dp2(d, d); // nadt/nadt + date_period dpx(d2, dx); // date/nadt + date_period dp2(dx, dx); // nadt/nadt date_period dp3(d3, d4); - ss << dp; + ss << dpx; ss >> dp2; - check_equal("Special values period (reversibility test)", dp, dp2); + check_equal("Special values period (reversibility test)", dpx, dp2); ss.str("[-infinity/+infinity]"); ss >> dp2; check_equal("Special values period (infinities)", dp3, dp2); @@ -489,29 +489,29 @@ int main(){ sv_parser, p_parser, dg_parser); - std::istringstream iss; - iss.imbue(std::locale(std::locale::classic(), de_facet)); + std::istringstream iss2; + iss2.imbue(std::locale(std::locale::classic(), de_facet)); // June 06 2005, Dec, minimum date, Tues - iss.str("Juni 06 2005 Dez Wenigstes Datum Die"); - iss >> d; - iss >> m; + iss2.str("Juni 06 2005 Dez Wenigstes Datum Die"); + iss2 >> d; + iss2 >> m; check_equal("German names: date", d, date(2005, Jun, 6)); check_equal("German names: month", m, greg_month(Dec)); - iss >> d; - iss >> gw; + iss2 >> d; + iss2 >> gw; 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; + iss2.str("Dienstag Zweitens Dienstag von Mar"); + iss2 >> gw; + iss2 >> nkd; 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; + iss2.str("Dienstag Nach"); + iss2 >> fka; check_equal("German names, first_day_of_the_week_after", fka.get_date(date(2005,Apr,5)), date(2005,Apr,12)); } @@ -552,25 +552,25 @@ int main(){ &month_long_names[12], std::back_inserter(long_month_names)); - date d(not_a_date_time); - date_input_facet* facet = new date_input_facet(); + date dx(not_a_date_time); + date_input_facet* facetx = new date_input_facet(); std::stringstream ss; - ss.imbue(std::locale(std::locale::classic(), facet)); - facet->short_month_names(short_month_names); - facet->short_weekday_names(short_weekday_names); - facet->long_month_names(long_month_names); - facet->long_weekday_names(long_weekday_names); - facet->format("%a %b %d, %Y"); + ss.imbue(std::locale(std::locale::classic(), facetx)); + facetx->short_month_names(short_month_names); + facetx->short_weekday_names(short_weekday_names); + facetx->long_month_names(long_month_names); + facetx->long_weekday_names(long_weekday_names); + facetx->format("%a %b %d, %Y"); ss.str("day7 *apr* 23, 2005"); - ss >> d; - 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 >> dx; + check_equal("Short custom names, set via accessor function", dx.day_of_week(), greg_weekday(6)); + check_equal("Short custom names, set via accessor function", dx.month(), greg_month(4)); ss.str(""); ss.str("Sun-0 **April** 24, 2005"); - facet->format("%A %B %d, %Y"); - ss >> d; - 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)); + facetx->format("%A %B %d, %Y"); + ss >> dx; + check_equal("Long custom names, set via accessor function", dx.day_of_week(), greg_weekday(0)); + check_equal("Long custom names, set via accessor function", dx.month(), greg_month(4)); } #else diff --git a/test/gregorian/testfacet.cpp b/test/gregorian/testfacet.cpp index 7139a98..82a7253 100644 --- a/test/gregorian/testfacet.cpp +++ b/test/gregorian/testfacet.cpp @@ -81,12 +81,12 @@ main() ss.str() == std::string("Okt")); ss.str(""); //reset string stream - greg_month m(Oct); - month_formatter::format_month(m, ss, gdnp); + greg_month mo(Oct); + month_formatter::format_month(mo, ss, gdnp); check("check german short month: " + ss.str(), ss.str() == std::string("Okt")); ss.str(""); //reset string stream -// month_formatter::format_month(m, ss, gdnp); +// month_formatter::format_month(mo, ss, gdnp); // check("check german long month: " + ss.str(), // ss.str() == std::string("Oktober")); @@ -277,7 +277,7 @@ main() /*******************************************************************/ { std::stringstream ss1("January"); - std::stringstream ss2("dec"); // misspelled + std::stringstream ss2m("dec"); // misspelled std::stringstream german("Okt"); german.imbue(global2); greg_month m(3); @@ -293,7 +293,7 @@ main() german >> m; check("Stream in German month", m == greg_month(Oct)); try{ - ss2 >> m; // misspelled + ss2m >> m; // misspelled check("Bad month exception NOT thrown (misspelled name)", false); }catch(bad_month&){ check("Bad month exception caught (misspelled name)", true); @@ -306,7 +306,7 @@ main() /*******************************************************************/ { std::stringstream ss1("Sun"); - std::stringstream ss2("Wensday"); // misspelled + std::stringstream ss2w("Wensday"); // misspelled std::stringstream german("Mittwoch"); // Wednesday german.imbue(global2); greg_weekday wd(Friday); //something not Sunday... @@ -322,7 +322,7 @@ main() german >> wd; check("Stream in German weekday", wd == greg_weekday(Wednesday)); try{ - ss2 >> wd; + ss2w >> wd; check("Bad weekday exception NOT thrown (misspelled name)", false); }catch(bad_weekday&){ check("Bad weekday exception caught (misspelled name)", true); diff --git a/test/gregorian/testgreg_durations.cpp b/test/gregorian/testgreg_durations.cpp index c1d056e..485d214 100644 --- a/test/gregorian/testgreg_durations.cpp +++ b/test/gregorian/testgreg_durations.cpp @@ -61,14 +61,14 @@ int main(){ d4 - months(-14) == date(2007,Jan,1)); } { - months m1(5), m2(3), m3(10); - check("months & int multipliable", months(15) == m1 * 3); - m1 *= 3; - check("months & int multipliable", months(15) == m1); - //check("int * months", months(12) == 4 * m2); - check("months & int dividable", months(3) == m3 / 3); - m3 /= 3; - check("months & int dividable", months(3) == m3); + months m1x(5), m2x(3), m3x(10); + check("months & int multipliable", months(15) == m1x * 3); + m1x *= 3; + check("months & int multipliable", months(15) == m1x); + //check("int * months", months(12) == 4 * m2x); + check("months & int dividable", months(3) == m3x / 3); + m3x /= 3; + check("months & int dividable", months(3) == m3x); } { months m(-5), m_pos(pos_infin), m_neg(neg_infin), m_nadt(not_a_date_time); @@ -116,14 +116,14 @@ int main(){ y3 -= y2; check("years & years subtractable", years(-1) == y3); { - years y1(5), y2(3), y3(10); - check("years & int multipliable", years(15) == y1 * 3); - y1 *= 3; - check("years & int multipliable", years(15) == y1); - //check("int * years", years(12) == 4 * y2); - check("years & int dividable", years(3) == y3 / 3); - y3 /= 3; - check("years & int dividable", years(3) == y3); + years y1x(5), y2x(3), y3x(10); + check("years & int multipliable", years(15) == y1x * 3); + y1x *= 3; + check("years & int multipliable", years(15) == y1x); + //check("int * years", years(12) == 4 * y2x); + check("years & int dividable", years(3) == y3x / 3); + y3x /= 3; + check("years & int dividable", years(3) == y3x); } { years m(15), y_pos(pos_infin), y_neg(neg_infin), y_nadt(not_a_date_time); diff --git a/test/gregorian/testgreg_wstream.cpp b/test/gregorian/testgreg_wstream.cpp index 79b02e1..08173fc 100644 --- a/test/gregorian/testgreg_wstream.cpp +++ b/test/gregorian/testgreg_wstream.cpp @@ -45,9 +45,9 @@ int main(){ #ifndef BOOST_NO_STD_ITERATOR_TRAITS { res = L"2003-Aug-21"; - std::wstringstream wss(L"2003-Aug-21"); + std::wstringstream wss2(L"2003-Aug-21"); date testdate(not_a_date_time); - wss >> testdate; + wss2 >> testdate; check("date operator>>", to_simple_wstring(testdate) == res); } #else @@ -66,9 +66,9 @@ int main(){ res = L"August"; check("greg_month as_long_wstring", ws == res); /*{ - std::wstringstream wss(L"August"); + std::wstringstream wss2(L"August"); greg_month testmonth(not_a_date_time); - wss >> testmonth; + wss2 >> testmonth; check("greg_month operator>>", to_simple_wstring(testmonth) == res); }*/ @@ -83,9 +83,9 @@ int main(){ res = L"Thursday"; check("greg_day_of_week as_long_wstring", ws == res); /*{ - std::wstringstream wss(L"Thu"); + std::wstringstream wss2(L"Thu"); greg_day_of_week testday(not_a_date_time); - wss >> testday; + wss2 >> testday; check("greg_day_of_week operator>>", to_simple_wstring(testday) == res); }*/ @@ -100,12 +100,12 @@ int main(){ ws = to_iso_wstring(dp); check("date_period to_iso_string", ws == res); { - std::wstringstream wss(L"[2003-Aug-21/2004-May-27]"); + std::wstringstream wss2(L"[2003-Aug-21/2004-May-27]"); res = L"[2003-Aug-21/2004-May-26]"; // following line gives an ambiguous overload of op>> //date_period testperiod(date(not_a_date_time),date_duration(not_a_date_time)); date_period testperiod(date(2003,Aug,21), date(2004,May,27)); - wss >> testperiod; + wss2 >> testperiod; check("date_period operator>>", to_simple_wstring(testperiod) == res); } @@ -115,9 +115,9 @@ int main(){ check("date_duration", wss.str() == res); wss.str(L""); { - std::wstringstream wss(L"280"); + std::wstringstream wss2(L"280"); date_duration testduration(not_a_date_time); - wss >> testduration; + wss2 >> testduration; check("date_duration operator>>", testduration.days() == 280); } diff --git a/test/gregorian/testparse_date.cpp b/test/gregorian/testparse_date.cpp index d9df989..a28280a 100644 --- a/test/gregorian/testparse_date.cpp +++ b/test/gregorian/testparse_date.cpp @@ -82,12 +82,12 @@ main() date d8 = from_uk_string("29-Feb-2000"); check("date from day-month-year string", d8 == d); { - std::string s("20050229"); // no Feb-29 in 2005 - date d(not_a_date_time); + std::string sn("20050229"); // no Feb-29 in 2005 + date dn(not_a_date_time); try { - d = date_from_iso_string(s); + dn = date_from_iso_string(sn); check("Expected exception not thrown: from ISO string (bad_day_of_month)", false); - std::cout << date_from_iso_string(s) << std::endl; + std::cout << date_from_iso_string(sn) << std::endl; } catch(bad_day_of_month&) { check("Caught expected exception: bad_day_of_month ", true); @@ -96,11 +96,11 @@ main() check("Caught unexpected exception", false); } /* not currently passing due to a bug in boost::offset_separator (reported 2005-Aug-02) - s = "2005022"; // missing a digit + sn = "2005022"; // missing a digit try { - d = date_from_iso_string(s); + d = date_from_iso_string(sn); check("Expected exception not thrown: from ISO string (missing digit)", false); - std::cout << date_from_iso_string(s) << std::endl; + std::cout << date_from_iso_string(sn) << std::endl; } catch(bad_day_of_month& e) { check("Caught expected exception: bad_day_of_month ", true); @@ -109,9 +109,9 @@ main() check("Caught unexpected exception", false); } */ - s = "20050228"; // now it's correct - d = date_from_iso_string(s); - check("from ISO string", date(2005,Feb,28) == d); + sn = "20050228"; // now it's correct + dn = date_from_iso_string(sn); + check("from ISO string", date(2005,Feb,28) == dn); } date d9 = from_us_string(__DATE__); diff --git a/test/local_time/testlocal_time.cpp b/test/local_time/testlocal_time.cpp index ed3347c..1f29016 100644 --- a/test/local_time/testlocal_time.cpp +++ b/test/local_time/testlocal_time.cpp @@ -122,16 +122,16 @@ main() std::cout << "\nChecking calc_options construction" << std::endl; { // invalid NADT - date d(2004, Apr, 4); + date dx(2004, Apr, 4); time_duration td(2,30,0); // invalid local time in ny_tz - local_date_time calcop(d, td, ny_tz, local_date_time::NOT_DATE_TIME_ON_ERROR); + local_date_time calcop(dx, td, ny_tz, local_date_time::NOT_DATE_TIME_ON_ERROR); check("is NADT", calcop.is_not_a_date_time()); } { // invalid exception - date d(2004, Apr, 4); + date dx(2004, Apr, 4); time_duration td(2,30,0); // invalid local time in ny_tz try{ - local_date_time calcop(d, td, ny_tz, local_date_time::EXCEPTION_ON_ERROR); + local_date_time calcop(dx, td, ny_tz, local_date_time::EXCEPTION_ON_ERROR); check("Did not catch expected exception", false); }catch(time_label_invalid& /*i*/){ check("Caught expected exception", true); @@ -140,16 +140,16 @@ main() } } { // ambig NADT - date d(2004, Oct, 31); + date dx(2004, Oct, 31); time_duration td(1,30,0); // ambig local time in ny_tz - local_date_time calcop(d, td, ny_tz, local_date_time::NOT_DATE_TIME_ON_ERROR); + local_date_time calcop(dx, td, ny_tz, local_date_time::NOT_DATE_TIME_ON_ERROR); check("is NADT", calcop.is_not_a_date_time()); } { // ambig exception - date d(2004, Oct, 31); + date dx(2004, Oct, 31); time_duration td(1,30,0); // ambig local time in ny_tz try{ - local_date_time calcop(d, td, ny_tz, local_date_time::EXCEPTION_ON_ERROR); + local_date_time calcop(dx, td, ny_tz, local_date_time::EXCEPTION_ON_ERROR); check("Did not catch expected exception", false); }catch(ambiguous_result& /*a*/){ check("Caught expected exception", true); @@ -199,10 +199,10 @@ main() // thorough is_dst() tests, tests againts null_tz and non dst tz are // done where those local times were tested { - date d(2004,Apr,4); + date dx(2004,Apr,4); time_duration td(1,15,0); // local - local_date_time lt1(d,td,ny_tz,false); - local_date_time lt2(ptime(d,time_duration(6,15,0)), ny_tz); + local_date_time lt1(dx,td,ny_tz,false); + local_date_time lt2(ptime(dx,time_duration(6,15,0)), ny_tz); check("are local_times equal", lt1.utc_time() == lt2.utc_time()); check("is_dst - transition in 1", lt1.is_dst() == false); check("is_dst - transition in 2", lt2.is_dst() == false); @@ -212,17 +212,17 @@ main() check("is_dst - transition in 2", lt2.is_dst() == true); } { - date d(2004,Oct,31); + date dx(2004,Oct,31); time_duration td(1,15,0); // local - local_date_time lt1(d,td,ny_tz,true); + local_date_time lt1(dx,td,ny_tz,true); /*try{ - //local_date_time lt1(d,td,ny_tz,false); - local_date_time lt1(d,td,ny_tz,true); + //local_date_time lt1(dx,td,ny_tz,false); + local_date_time lt1(dx,td,ny_tz,true); std::cout << "no exception thrown" << std::endl; }catch(time_label_invalid& e){ std::cout << "caught: " << e.what() << std::endl; }*/ - local_date_time lt2(ptime(d,time_duration(5,15,0)), ny_tz); + local_date_time lt2(ptime(dx,time_duration(5,15,0)), ny_tz); check("are local_times equal", lt1.utc_time() == lt2.utc_time()); check("is_dst - transition out 1", lt1.is_dst() == true); check("is_dst - transition out 2", lt2.is_dst() == true); @@ -232,17 +232,17 @@ main() check("is_dst - transition out 2", lt2.is_dst() == false); } { // southern hemisphere - date d(2004,Oct,31); + date dx(2004,Oct,31); time_duration td(1,15,0); // local - local_date_time lt1(d,td,sydney,false); + local_date_time lt1(dx,td,sydney,false); check("is_dst - transition in (sydney)", lt1.is_dst() == false); lt1 += hours(1); check("is_dst - transition in (sydney)", lt1.is_dst() == true); } { - date d(2004,Mar,28); + date dx(2004,Mar,28); time_duration td(2,15,0); // local; sydney has a weird trans time - local_date_time lt1(d,td,sydney,true); + local_date_time lt1(dx,td,sydney,true); check("is_dst - transition out (sydney)", lt1.is_dst() == true); lt1 += hours(1); check("is_dst - transition out (sydney)", lt1.is_dst() == false); @@ -266,16 +266,16 @@ main() { // test comparisons & math operations - date d(2003, Aug, 28); + date dx(2003, Aug, 28); ptime sv_pt(pos_infin); local_date_time sv_lt(sv_pt, ny_tz); - ptime utc_pt(d, hours(12)); + ptime utc_pt(dx, hours(12)); // all 4 of the following local times happen at the same instant // so they are all equal local_date_time utc_lt(utc_pt, null_tz); // noon in utc - local_date_time az_lt(d, hours(5), az_tz, false); // 5am local std - local_date_time ny_lt(d, hours(8), ny_tz, true); // 8am local dst - local_date_time au_lt(d, hours(22), sydney, false);// 10pm local std + local_date_time az_lt(dx, hours(5), az_tz, false); // 5am local std + local_date_time ny_lt(dx, hours(8), ny_tz, true); // 8am local dst + local_date_time au_lt(dx, hours(22), sydney, false);// 10pm local std check("local_date_time to tm", std::string("4 239 08/28/2003 05:00:00 STD") == tm_out(to_tm(az_lt))); diff --git a/test/local_time/testlocal_time_facet.cpp b/test/local_time/testlocal_time_facet.cpp index d9108a0..2046ac1 100644 --- a/test/local_time/testlocal_time_facet.cpp +++ b/test/local_time/testlocal_time_facet.cpp @@ -34,7 +34,7 @@ teststreaming(std::string const& testname, #endif } -int main(int argc, char const* argv[]){ +int main(int /* argc */, char const* argv[]){ /* use the tz_database for the time zones. * Chicago, Denver, Los_Angeles, New_Tork, and Phoenix * have all had full names added */ diff --git a/test/local_time/testlocal_time_input_facet.cpp b/test/local_time/testlocal_time_input_facet.cpp index 207e26f..7622e56 100644 --- a/test/local_time/testlocal_time_input_facet.cpp +++ b/test/local_time/testlocal_time_input_facet.cpp @@ -184,8 +184,8 @@ int main() { { std::istringstream iss("2005-Aug-25 12:15:00 MST-07"); local_time_input_facet* f = new local_time_input_facet("%Y-%b-%d %H:%M:%S %z"); - std::locale loc(std::locale::classic(), f); - iss.imbue(loc); + std::locale locx(std::locale::classic(), f); + iss.imbue(locx); iss >> ldt1; check("Wrong format flag makes UTC", ldt1.zone_as_posix_string() == std::string("UTC+00")); check("Wrong format flag makes UTC", ldt1.utc_time() == ldt1.local_time()); diff --git a/test/local_time/testtz_database.cpp b/test/local_time/testtz_database.cpp index 366c7bb..add2943 100644 --- a/test/local_time/testtz_database.cpp +++ b/test/local_time/testtz_database.cpp @@ -17,7 +17,7 @@ bool run_bad_field_count_test(char const* fn); -int main(int argc, char const* argv[]){ +int main(int /* argc */, char const* argv[]){ using namespace boost::gregorian; using namespace boost::posix_time; using namespace boost::local_time; diff --git a/test/posix_time/testlocal_adjustor.cpp b/test/posix_time/testlocal_adjustor.cpp index c84c6ba..8eb572b 100644 --- a/test/posix_time/testlocal_adjustor.cpp +++ b/test/posix_time/testlocal_adjustor.cpp @@ -121,12 +121,13 @@ main() typedef boost::date_time::local_adjustor us_eastern2; - ptime t7a(date(2002,May,31), hours(17)); - ptime t7b = us_eastern2::local_to_utc(t7a); - ptime t7c = us_eastern2::utc_to_local(t7b); - //converted to local then back ot utc - check("check us_local_adjustor", t7c == t7a); - + { + ptime t7a(date(2002,May,31), hours(17)); + ptime t7b = us_eastern2::local_to_utc(t7a); + ptime t7c = us_eastern2::utc_to_local(t7b); + //converted to local then back ot utc + check("check us_local_adjustor", t7c == t7a); + } typedef boost::date_time::us_dst_trait us_dst_traits; typedef boost::date_time::dst_calc_engine diff --git a/test/posix_time/testparse_time.cpp b/test/posix_time/testparse_time.cpp index 17d0994..60eb90c 100644 --- a/test/posix_time/testparse_time.cpp +++ b/test/posix_time/testparse_time.cpp @@ -104,10 +104,12 @@ main() #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS - std::string ts2("2002-12-31 00:00:00.999999999"); - ptime t2 = time_from_string(ts2); - check("parse time: " + ts2, - t2 == ptime(date(2002,12,31),time_duration(0,0,0)+nanosec(999999999))); + { + std::string ts2("2002-12-31 00:00:00.999999999"); + ptime t2 = time_from_string(ts2); + check("parse time: " + ts2, + t2 == ptime(date(2002,12,31),time_duration(0,0,0)+nanosec(999999999))); + } { std::string ts2("2002-12-31 00:00:00."); ptime t2 = time_from_string(ts2); @@ -128,13 +130,15 @@ main() // std::cout << tod_1 << "|" << std::endl; - ptime t1 = time_from_string(ts1); - check("parse time: " + ts1, - t1 == ptime(date(2002,1,20),time_duration(23,59,59))); { - std::string ts1("2002-01-20 23:59:59."); ptime t1 = time_from_string(ts1); - check("parse time (decimal but no digits): " + ts1, + check("parse time: " + ts1, + t1 == ptime(date(2002,1,20),time_duration(23,59,59))); + } + { + std::string ts1x("2002-01-20 23:59:59."); + ptime t1 = time_from_string(ts1x); + check("parse time (decimal but no digits): " + ts1x, t1 == ptime(date(2002,1,20),time_duration(23,59,59))); } @@ -148,21 +152,27 @@ main() check("parse negative time duration: " + s6, td6 == time_duration(-23,58,59)); - std::string ts3("20020120T235859"); - ptime t20 = from_iso_string(ts3); - check("parse iso time: " + ts3, - t20 == ptime(date(2002,1,20),time_duration(23,58,59))); - + { + std::string ts3("20020120T235859"); + ptime t20 = from_iso_string(ts3); + check("parse iso time: " + ts3, + t20 == ptime(date(2002,1,20),time_duration(23,58,59))); + } - std::string ts4("19001231T000000"); - ptime t21 = from_iso_string(ts4); - check("parse iso time: " + ts4, - t21 == ptime(date(1900,12,31),time_duration(0,0,0))); + { + std::string ts4("19001231T000000"); + ptime t21 = from_iso_string(ts4); + check("parse iso time: " + ts4, + t21 == ptime(date(1900,12,31),time_duration(0,0,0))); + } + + { + std::string ts5("19001231T23"); + ptime t22 = from_iso_string(ts5); + check("parse iso time: " + ts5, + t22 == ptime(date(1900,12,31),time_duration(23,0,0))); + } - std::string ts5("19001231T23"); - ptime t22 = from_iso_string(ts5); - check("parse iso time: " + ts5, - t22 == ptime(date(1900,12,31),time_duration(23,0,0))); { #if defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG) std::string ts3("20020120T235859.123456789"); diff --git a/test/posix_time/teststreams.cpp b/test/posix_time/teststreams.cpp index d30692a..c772fae 100644 --- a/test/posix_time/teststreams.cpp +++ b/test/posix_time/teststreams.cpp @@ -124,14 +124,14 @@ main() } { - date d1(2001,Aug,1), d2(2003,May,13); + date d1x(2001,Aug,1), d2x(2003,May,13); #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS - time_duration td1(15,32,18,20304000), td2(1,2,3); + time_duration td1x(15,32,18,20304000), td2x(1,2,3); #else - time_duration td1(15,32,18,20304), td2(1,2,3); + time_duration td1x(15,32,18,20304), td2x(1,2,3); #endif - time_period result(ptime(d1,td1), ptime(d2,td2)); + time_period result(ptime(d1x,td1x), ptime(d2x,td2x)); std::istringstream iss("[2001-Aug-01 15:32:18.020304/2003-May-13 01:02:03]"); iss >> tp; check("Stream in time_period", tp == result); @@ -150,11 +150,11 @@ main() std::wistringstream wiss3(L"[2004-Jan-01 02:03:04/2004-May-13 01:00:00]"); wiss3 >> tp; - date d1 = date(2004,Jan,1); - date d2 = date(2004,May,13); - time_duration td1 = time_duration(2,3,4); - time_duration td2 = time_duration(1,0,0); - time_period result = time_period(ptime(d1,td1), ptime(d2,td2)); + date d1x = date(2004,Jan,1); + date d2x = date(2004,May,13); + time_duration td1x = time_duration(2,3,4); + time_duration td2x = time_duration(1,0,0); + time_period result = time_period(ptime(d1x,td1x), ptime(d2x,td2x)); check("Wide stream in time_period", tp == result); } #else diff --git a/test/posix_time/testtime.cpp b/test/posix_time/testtime.cpp index 02b18a3..f66c869 100644 --- a/test/posix_time/testtime.cpp +++ b/test/posix_time/testtime.cpp @@ -193,11 +193,11 @@ main() std::cout << to_simple_string(td2) << std::endl; check("add 2001-Dec-01 0:0:0 + 01:02:03", t9 == t10); { - ptime t9(date(2001,Dec,1), time_duration(12,0,0)); //Dec 1 at Noon + ptime t9x(date(2001,Dec,1), time_duration(12,0,0)); //Dec 1 at Noon time_duration td3(-4,0,0); check("add 2001-Dec-01 12:00:00 + (-04:00:00)", - t9+td3 == ptime(date(2001,Dec,1), time_duration(8,0,0)) ); - std::cout << to_simple_string(t9-td3) << std::endl; + t9x+td3 == ptime(date(2001,Dec,1), time_duration(8,0,0)) ); + std::cout << to_simple_string(t9x-td3) << std::endl; } time_duration td3(24,0,0); // a day check("add 2001-Dec-01 0:0:0 + 24:00:00", t8+td3 == ptime(date(2001,Dec,2))); diff --git a/test/posix_time/testtime_facet.cpp b/test/posix_time/testtime_facet.cpp index cb0d921..f912f8d 100644 --- a/test/posix_time/testtime_facet.cpp +++ b/test/posix_time/testtime_facet.cpp @@ -220,8 +220,8 @@ int main() { // not dereference end() iterator for the format string in do_put_tm. { boost::gregorian::date date(2009, 1, 1); - boost::posix_time::time_duration td(0, 0, 0, 0); - boost::posix_time::ptime boost_time(date, td); + boost::posix_time::time_duration tdx(0, 0, 0, 0); + boost::posix_time::ptime boost_time(date, tdx); std::stringstream sstr; boost::posix_time::time_facet* pFacet = new boost::posix_time::time_facet(""); diff --git a/test/posix_time/testtime_input_facet.cpp b/test/posix_time/testtime_input_facet.cpp index f858ac9..126810c 100644 --- a/test/posix_time/testtime_input_facet.cpp +++ b/test/posix_time/testtime_input_facet.cpp @@ -178,38 +178,38 @@ do_all_tests() 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(); - facet->time_duration_format("%H""%M""%S""%F"); // iso format + time_input_facet *facet2 = new time_input_facet(); + facet2->set_iso_format(); + facet2->time_duration_format("%H""%M""%S""%F"); // iso format std::stringstream ss; - ss.imbue(std::locale(std::locale::classic(), facet)); - ptime pt(not_a_date_time); - time_duration td(not_a_date_time); - date d(2002,Oct,17); + ss.imbue(std::locale(std::locale::classic(), facet2)); + ptime pt2(not_a_date_time); + time_duration tdx(not_a_date_time); + date dx(2002,Oct,17); #if defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG) time_duration td2(23,12,17,123450000); #else time_duration td2(23,12,17,123450); #endif - ptime result(d, td2); + ptime result(dx, td2); ss.str("20021017T231217.12345"); - ss >> pt; - check_equal("iso_format ptime", pt, result); + ss >> pt2; + check_equal("iso_format ptime", pt2, result); ss.str(""); - facet->set_iso_extended_format(); + facet2->set_iso_extended_format(); ss.str("2002-10-17 23:12:17.12345"); - ss >> pt; - check_equal("iso_extended_format ptime", pt, result); + ss >> pt2; + check_equal("iso_extended_format ptime", pt2, result); ss.str(""); ss.str("231217.12345"); - ss >> td; - check_equal("iso_format time_duration", td, td2); + ss >> tdx; + check_equal("iso_format time_duration", tdx, td2); ss.str(""); ss.str("-infinity"); - ss >> td; + ss >> tdx; check_equal("iso_format time_duration (special_value)", - td, time_duration(neg_infin)); + tdx, 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 @@ -217,35 +217,35 @@ do_all_tests() ss.exceptions(std::ios_base::failbit); // we need exceptions turned on here int count = 0; try { - facet->time_duration_format("%H""%M""%S""%F"); + facet2->time_duration_format("%H""%M""%S""%F"); ss.str("not-a-date-time"); ++count; - ss >> td; - check_equal("special value w/ hours flag", td, nadt); + ss >> tdx; + check_equal("special value w/ hours flag", tdx, nadt); ss.str(""); - facet->time_duration_format("%M""%S""%F"); + facet2->time_duration_format("%M""%S""%F"); ss.str("not-a-date-time"); ++count; - ss >> td; - check_equal("special value w/ minutes flag", td, nadt); + ss >> tdx; + check_equal("special value w/ minutes flag", tdx, nadt); ss.str(""); - facet->time_duration_format("%S""%F"); + facet2->time_duration_format("%S""%F"); ss.str("not-a-date-time"); ++count; - ss >> td; - check_equal("special value w/ seconds flag", td, nadt); + ss >> tdx; + check_equal("special value w/ seconds flag", tdx, nadt); ss.str(""); - facet->time_duration_format("%s"); + facet2->time_duration_format("%s"); ss.str("not-a-date-time"); ++count; - ss >> td; - check_equal("special value w/ sec w/frac_sec (always) flag", td, nadt); + ss >> tdx; + check_equal("special value w/ sec w/frac_sec (always) flag", tdx, nadt); ss.str(""); - facet->time_duration_format("%f"); + facet2->time_duration_format("%f"); ss.str("not-a-date-time"); ++count; - ss >> td; - check_equal("special value w/ frac_sec (always) flag", td, nadt); + ss >> tdx; + check_equal("special value w/ frac_sec (always) flag", tdx, nadt); ss.str(""); } catch(...) { @@ -332,16 +332,16 @@ do_all_tests() (tp.end() == ptime(date(2005,12,31),time_duration(23,59,59,1))) ); { std::stringstream ss; - ptime pt(not_a_date_time); + ptime ptx(not_a_date_time); ptime pt2 = second_clock::local_time(); ptime pt3(neg_infin); ptime pt4(pos_infin); - time_period tp(pt2, pt); // ptime/nadt - time_period tp2(pt, pt); // nadt/nadt + time_period tpx(pt2, ptx); // ptime/nadt + time_period tp2(ptx, ptx); // nadt/nadt time_period tp3(pt3, pt4); - ss << tp; + ss << tpx; ss >> tp2; - check_equal("Special values period (reversibility test)", tp, tp2); + check_equal("Special values period (reversibility test)", tpx, tp2); ss.str("[-infinity/+infinity]"); ss >> tp2; check_equal("Special values period (infinities)", tp3, tp2); @@ -415,10 +415,10 @@ do_all_tests() // trac 13194 (https://svn.boost.org/trac10/ticket/13194) { const std::string value = "December 07:27:10.435945 5 2017"; - boost::posix_time::time_input_facet* facet = new boost::posix_time::time_input_facet("%B %H:%M:%s %e %Y"); - boost::posix_time::ptime pt; - check("trac 13194 %e on \"5\" failbit set", !failure_test(pt, value, facet)); // proves failbit was not set - check_equal("trac 13194 %e on \" 5\" valid value", "2017-12-05T07:27:10.435945000", to_iso_extended_string(pt)); + boost::posix_time::time_input_facet* facet4 = new boost::posix_time::time_input_facet("%B %H:%M:%s %e %Y"); + boost::posix_time::ptime ptx; + check("trac 13194 %e on \"5\" failbit set", !failure_test(ptx, value, facet4)); // proves failbit was not set + check_equal("trac 13194 %e on \" 5\" valid value", "2017-12-05T07:27:10.435945000", to_iso_extended_string(ptx)); } // trac 12910 diff --git a/test/testconstrained_value.cpp b/test/testconstrained_value.cpp index 7db8d10..c7a3b49 100644 --- a/test/testconstrained_value.cpp +++ b/test/testconstrained_value.cpp @@ -43,8 +43,8 @@ int main() try { - constrained_value cv2(11); - std::cout << "Not Reachable: " << cv2 << " "; + constrained_value cv3(11); + std::cout << "Not Reachable: " << cv3 << " "; check("got range exception max", false); } catch(range_error& e) { diff --git a/test/testgeneric_period.cpp b/test/testgeneric_period.cpp index 230c25c..64c1ff5 100644 --- a/test/testgeneric_period.cpp +++ b/test/testgeneric_period.cpp @@ -59,14 +59,6 @@ int main(){ check("End", p1.end() == 10); check("Length", p1.length() == 9); check("is_null (not)", !p1.is_null()); - { - a_period p1(1, 10); - check("First", p1.begin() == 1); - check("Last", p1.last() == 9); - check("End", p1.end() == 10); - check("Length", p1.length() == 9); - check("is_null (not)", !p1.is_null()); - } a_period p2(5, 30); check("First", p2.begin() == 5); @@ -165,117 +157,117 @@ int main(){ { std::cout << std::endl; - a_period p1(0, -2); - check("First", p1.begin() == 0); - check("Last", p1.last() == -3); - check("End", p1.end() == -2); - check("Length", p1.length() == -2); - check("is_null", p1.is_null()); + a_period p1x(0, -2); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == -3); + check("End", p1x.end() == -2); + check("Length", p1x.length() == -2); + check("is_null", p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, -1); - check("First", p1.begin() == 0); - check("Last", p1.last() == -2); - check("End", p1.end() == -1); - check("Length", p1.length() == -1); - check("is_null", p1.is_null()); + a_period p1x(0, -1); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == -2); + check("End", p1x.end() == -1); + check("Length", p1x.length() == -1); + check("is_null", p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, 0); - check("First", p1.begin() == 0); - check("Last", p1.last() == -1); - check("End", p1.end() == 0); - check("Length", p1.length() == 0); - check("is_null", p1.is_null()); + a_period p1x(0, 0); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == -1); + check("End", p1x.end() == 0); + check("Length", p1x.length() == 0); + check("is_null", p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, 1); - check("First", p1.begin() == 0); - check("Last", p1.last() == 0); - check("End", p1.end() == 1); - check("Length", p1.length() == 1); - check("is_null", !p1.is_null()); + a_period p1x(0, 1); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == 0); + check("End", p1x.end() == 1); + check("Length", p1x.length() == 1); + check("is_null", !p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, 2); - check("First", p1.begin() == 0); - check("Last", p1.last() == 1); - check("End", p1.end() == 2); - check("Length", p1.length() == 2); - check("is_null", !p1.is_null()); + a_period p1x(0, 2); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == 1); + check("End", p1x.end() == 2); + check("Length", p1x.length() == 2); + check("is_null", !p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, duration_type(-1)); - check("First", p1.begin() == 0); - check("Last", p1.last() == -2); - check("End", p1.end() == -1); - check("Length", p1.length() == -1); - check("is_null", p1.is_null()); + a_period p1x(0, duration_type(-1)); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == -2); + check("End", p1x.end() == -1); + check("Length", p1x.length() == -1); + check("is_null", p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, duration_type(-2)); - check("First", p1.begin() == 0); - check("Last", p1.last() == -3); - check("End", p1.end() == -2); - check("Length", p1.length() == -2); - check("is_null", p1.is_null()); + a_period p1x(0, duration_type(-2)); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == -3); + check("End", p1x.end() == -2); + check("Length", p1x.length() == -2); + check("is_null", p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, duration_type(0)); - check("First", p1.begin() == 0); - check("Last", p1.last() == -1); - check("End", p1.end() == 0); - check("Length", p1.length() == 0); - check("is_null", p1.is_null()); + a_period p1x(0, duration_type(0)); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == -1); + check("End", p1x.end() == 0); + check("Length", p1x.length() == 0); + check("is_null", p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, duration_type(1)); - check("First", p1.begin() == 0); - check("Last", p1.last() == 0); - check("End", p1.end() == 1); - check("Length", p1.length() == 1); - check("is_null", !p1.is_null()); + a_period p1x(0, duration_type(1)); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == 0); + check("End", p1x.end() == 1); + check("Length", p1x.length() == 1); + check("is_null", !p1x.is_null()); } { std::cout << std::endl; - a_period p1(0, duration_type(2)); - check("First", p1.begin() == 0); - check("Last", p1.last() == 1); - check("End", p1.end() == 2); - check("Length", p1.length() == 2); - check("is_null", !p1.is_null()); + a_period p1x(0, duration_type(2)); + check("First", p1x.begin() == 0); + check("Last", p1x.last() == 1); + check("End", p1x.end() == 2); + check("Length", p1x.length() == 2); + check("is_null", !p1x.is_null()); } { std::cout << std::endl; - a_period p1(1,1); // length should be 0 - a_period p2(1,2); // length should be 1 - a_period p3(1,3); // length should be 2 - check("Length p1", p1.length() == 0); - check("Length p2", p2.length() == 1); - check("Length p3", p3.length() == 2); - check("is_null p1 (not)", p1.is_null()); - check("is_null p2 (not)", !p2.is_null()); + a_period p1x(1,1); // length should be 0 + a_period p2x(1,2); // length should be 1 + a_period p3x(1,3); // length should be 2 + check("Length p1", p1x.length() == 0); + check("Length p2", p2x.length() == 1); + check("Length p3", p3x.length() == 2); + check("is_null p1 (not)", p1x.is_null()); + check("is_null p2 (not)", !p2x.is_null()); } { - a_period p1(1,2); // length should be 1 - p1.shift(duration_type(1)); - a_period p2(2,3); // shifted result - check("shift", p1 == p2); + a_period p1x(1,2); // length should be 1 + p1x.shift(duration_type(1)); + a_period p2x(2,3); // shifted result + check("shift", p1x == p2x); } { - a_period p1(5,duration_type(3)); - a_period p2(3,10); // expanded result - p1.expand(duration_type(2)); //from 2000-Jan-01--2000-Jan-04 - check("expand", p1 == p2); + a_period p1x(5,duration_type(3)); + a_period p2x(3,10); // expanded result + p1x.expand(duration_type(2)); //from 2000-Jan-01--2000-Jan-04 + check("expand", p1x == p2x); } return printTestStats(); } diff --git a/test/testint_adapter.cpp b/test/testint_adapter.cpp index 8abba21..b5657f6 100644 --- a/test/testint_adapter.cpp +++ b/test/testint_adapter.cpp @@ -96,10 +96,10 @@ void test_int() check("is special_value (pos_inf)", l.is_special()); check("add infinity" , l == int_type::pos_infinity()); { // limiting the scope for these tests was easier than recalculating l - int_type l = i - int_type::pos_infinity(); - check("value - +infinity", l == int_type::neg_infinity()); - l = i + int_type::neg_infinity(); - check("value + -infinity", l == int_type::neg_infinity()); + int_type m = i - int_type::pos_infinity(); + check("value - +infinity", m == int_type::neg_infinity()); + m = i + int_type::neg_infinity(); + check("value + -infinity", m == int_type::neg_infinity()); } check("inf - inf = nan", (l - l) == int_type::not_a_number()); check("-inf + inf = nan", (j + l) == int_type::not_a_number()); diff --git a/test/testwrapping_int.cpp b/test/testwrapping_int.cpp index 67f9bf7..b33a9d2 100644 --- a/test/testwrapping_int.cpp +++ b/test/testwrapping_int.cpp @@ -49,12 +49,12 @@ main() check("signed int - value", wi3 == 0); { // subtracting negative values - wrapping_int wi3(5); + wrapping_int wi4(5); check("subtract negative value to cause wrap", - (wi3.subtract(-8) == -1 && wi3 == 3)); - check("reset", wi3.add(2) == 0 && wi3 ==5); + (wi4.subtract(-8) == -1 && wi4 == 3)); + check("reset", wi4.add(2) == 0 && wi4 ==5); check("add negative value to cause wrap", - (wi3.add(-8) == -1 && wi3 == 7)); + (wi4.add(-8) == -1 && wi4 == 7)); } wrapping_int2 wi4(1); diff --git a/xmldoc/Jamfile.v2 b/xmldoc/Jamfile.v2 index af4aea8..5bfec0b 100644 --- a/xmldoc/Jamfile.v2 +++ b/xmldoc/Jamfile.v2 @@ -4,8 +4,6 @@ # file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) # -project libs/date_time/xmldoc ; - import set ; using boostbook ;