Fix differences in some sub() results that were causing tests to fail.

This commit is contained in:
Daniel Convissor 2011-08-23 16:40:19 +00:00
parent 9fb62f3382
commit 7473a889ec
4 changed files with 22 additions and 11 deletions

View File

@ -20,6 +20,7 @@ examine_diff('2007-02-07', '2000-02-07', 'P+7Y0M0DT0H0M0S', 2557);
echo "test_years_positive__7_by_1_day: ";
examine_diff('2007-02-08', '2000-02-07', 'P+7Y0M1DT0H0M0S', 2558);
// NOTE: sub() produces different answer.
echo "test_years_positive__6_shy_1_day: ";
examine_diff('2007-02-06', '2000-02-07', 'P+6Y11M30DT0H0M0S', 2556);
@ -48,6 +49,7 @@ examine_diff('2000-02-07', '2007-02-07', 'P-7Y0M0DT0H0M0S', 2557);
echo "test_years_negative__7_by_1_day: ";
examine_diff('2000-02-07', '2007-02-08', 'P-7Y0M1DT0H0M0S', 2558);
// NOTE: sub() produces different answer.
echo "test_years_negative__6_shy_1_day: ";
examine_diff('2000-02-07', '2007-02-06', 'P-6Y11M28DT0H0M0S', 2556);

View File

@ -71,15 +71,19 @@ examine_diff('2010-03-01', '2010-01-01', 'P+0Y2M0DT0H0M0S', 59);
echo "test_bug_49081__20: ";
examine_diff('2010-03-01', '2010-01-31', 'P+0Y0M29DT0H0M0S', 29);
// NOTE: sub() produces different answer.
echo "test_bug_49081__21: ";
examine_diff('2010-03-27', '2010-01-31', 'P+0Y1M24DT0H0M0S', 55);
// NOTE: sub() produces different answer.
echo "test_bug_49081__22: ";
examine_diff('2010-03-28', '2010-01-31', 'P+0Y1M25DT0H0M0S', 56);
// NOTE: sub() produces different answer.
echo "test_bug_49081__23: ";
examine_diff('2010-03-29', '2010-01-31', 'P+0Y1M26DT0H0M0S', 57);
// NOTE: sub() produces different answer.
echo "test_bug_49081__24: ";
examine_diff('2010-03-30', '2010-01-31', 'P+0Y1M27DT0H0M0S', 58);
@ -168,18 +172,23 @@ examine_diff('2010-01-27', '2010-02-28', 'P-0Y1M1DT0H0M0S', 32);
echo "test_bug_49081_negative__19: ";
examine_diff('2010-01-01', '2010-03-01', 'P-0Y2M0DT0H0M0S', 59);
// NOTE: sub() produces different answer.
echo "test_bug_49081_negative__20: ";
examine_diff('2010-01-31', '2010-03-01', 'P-0Y1M1DT0H0M0S', 29);
// NOTE: sub() produces different answer.
echo "test_bug_49081_negative__21: ";
examine_diff('2010-01-31', '2010-03-27', 'P-0Y1M27DT0H0M0S', 55);
// NOTE: sub() produces different answer.
echo "test_bug_49081_negative__22: ";
examine_diff('2010-01-31', '2010-03-28', 'P-0Y1M28DT0H0M0S', 56);
// NOTE: sub() produces different answer.
echo "test_bug_49081_negative__23: ";
examine_diff('2010-01-31', '2010-03-29', 'P-0Y1M29DT0H0M0S', 57);
// NOTE: sub() produces different answer.
echo "test_bug_49081_negative__24: ";
examine_diff('2010-01-31', '2010-03-30', 'P-0Y1M30DT0H0M0S', 58);

View File

@ -14,7 +14,7 @@ require 'DateTime_data-dates.inc';
test__7: SUB: 2009-01-14 00:00:00 EST - P+0Y0M7DT0H0M0S = **2009-01-07 00:00:00 EST**
test_years_positive__7_by_0_day: SUB: 2007-02-07 00:00:00 EST - P+7Y0M0DT0H0M0S = **2000-02-07 00:00:00 EST**
test_years_positive__7_by_1_day: SUB: 2007-02-08 00:00:00 EST - P+7Y0M1DT0H0M0S = **2000-02-07 00:00:00 EST**
test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-07 00:00:00 EST**
test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-05 00:00:00 EST**
test_years_positive__7_by_1_month: SUB: 2007-03-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **2000-02-07 00:00:00 EST**
test_years_positive__6_shy_1_month: SUB: 2007-01-07 00:00:00 EST - P+6Y11M0DT0H0M0S = **2000-02-07 00:00:00 EST**
test_years_positive__7_by_1_month_split_newyear: SUB: 2007-01-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **1999-12-07 00:00:00 EST**
@ -22,7 +22,7 @@ test_years_positive__6_shy_1_month_split_newyear: SUB: 2006-12-07 00:00:00 EST -
test_negative__7: SUB: 2009-01-07 00:00:00 EST - P-0Y0M7DT0H0M0S = **2009-01-14 00:00:00 EST**
test_years_negative__7_by_0_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M0DT0H0M0S = **2007-02-07 00:00:00 EST**
test_years_negative__7_by_1_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M1DT0H0M0S = **2007-02-08 00:00:00 EST**
test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-06 00:00:00 EST**
test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-04 00:00:00 EST**
test_years_negative__7_by_1_month: SUB: 2000-02-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-03-07 00:00:00 EST**
test_years_negative__6_shy_1_month: SUB: 2000-02-07 00:00:00 EST - P-6Y11M0DT0H0M0S = **2007-01-07 00:00:00 EST**
test_years_negative__7_by_1_month_split_newyear: SUB: 1999-12-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-01-07 00:00:00 EST**

View File

@ -31,10 +31,10 @@ test_bug_49081__17: SUB: 2010-02-28 00:00:00 EST - P+0Y1M0DT0H0M0S = **2010-01-2
test_bug_49081__18: SUB: 2010-02-28 00:00:00 EST - P+0Y1M1DT0H0M0S = **2010-01-27 00:00:00 EST**
test_bug_49081__19: SUB: 2010-03-01 00:00:00 EST - P+0Y2M0DT0H0M0S = **2010-01-01 00:00:00 EST**
test_bug_49081__20: SUB: 2010-03-01 00:00:00 EST - P+0Y0M29DT0H0M0S = **2010-01-31 00:00:00 EST**
test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-01-31 00:00:00 EST**
test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-01-31 00:00:00 EST**
test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-01-31 00:00:00 EST**
test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-01-31 00:00:00 EST**
test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-02-03 00:00:00 EST**
test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-02-03 00:00:00 EST**
test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-02-03 00:00:00 EST**
test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-02-03 00:00:00 EST**
test_bug_49081__25: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M0DT0H0M0S = **2010-01-31 00:00:00 EST**
test_bug_49081__26: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M1DT0H0M0S = **2010-01-30 00:00:00 EST**
test_bug_49081__27: SUB: 2009-01-31 00:00:00 EST - P+0Y0M30DT0H0M0S = **2009-01-01 00:00:00 EST**
@ -62,11 +62,11 @@ test_bug_49081_negative__16: SUB: 2010-01-29 00:00:00 EST - P-0Y0M30DT0H0M0S = *
test_bug_49081_negative__17: SUB: 2010-01-28 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST**
test_bug_49081_negative__18: SUB: 2010-01-27 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST**
test_bug_49081_negative__19: SUB: 2010-01-01 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-01 00:00:00 EST**
test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-01 00:00:00 EST**
test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-27 00:00:00 EDT**
test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-28 00:00:00 EDT**
test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-03-29 00:00:00 EDT**
test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-03-30 00:00:00 EDT**
test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-04 00:00:00 EST**
test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-30 00:00:00 EDT**
test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-31 00:00:00 EDT**
test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-04-01 00:00:00 EDT**
test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-04-02 00:00:00 EDT**
test_bug_49081_negative__25: SUB: 2010-01-31 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-31 00:00:00 EDT**
test_bug_49081_negative__26: SUB: 2010-01-30 00:00:00 EST - P-0Y2M1DT0H0M0S = **2010-03-31 00:00:00 EDT**
test_bug_49081_negative__27: SUB: 2009-01-01 00:00:00 EST - P-0Y0M30DT0H0M0S = **2009-01-31 00:00:00 EST**