DateTime_data-february.inc 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. /*
  3. * Note: test names match method names in a set of PHPUnit tests
  4. * in a userland package. Please be so kind as to leave them.
  5. */
  6. date_default_timezone_set('America/New_York');
  7. /*
  8. * Check PHP bug 49081
  9. */
  10. echo "test_bug_49081__1: ";
  11. examine_diff('2010-03-31', '2010-03-01', 'P+0Y0M30DT0H0M0S', 30);
  12. echo "test_bug_49081__2: ";
  13. examine_diff('2010-04-01', '2010-03-01', 'P+0Y1M0DT0H0M0S', 31);
  14. echo "test_bug_49081__3: ";
  15. examine_diff('2010-04-01', '2010-03-31', 'P+0Y0M1DT0H0M0S', 1);
  16. echo "test_bug_49081__4: ";
  17. examine_diff('2010-04-29', '2010-03-31', 'P+0Y0M29DT0H0M0S', 29);
  18. echo "test_bug_49081__5: ";
  19. examine_diff('2010-04-30', '2010-03-31', 'P+0Y0M30DT0H0M0S', 30);
  20. echo "test_bug_49081__6: ";
  21. examine_diff('2010-04-30', '2010-03-30', 'P+0Y1M0DT0H0M0S', 31);
  22. echo "test_bug_49081__7: ";
  23. examine_diff('2010-04-30', '2010-03-29', 'P+0Y1M1DT0H0M0S', 32);
  24. echo "test_bug_49081__8: ";
  25. examine_diff('2010-01-29', '2010-01-01', 'P+0Y0M28DT0H0M0S', 28);
  26. echo "test_bug_49081__9: ";
  27. examine_diff('2010-01-30', '2010-01-01', 'P+0Y0M29DT0H0M0S', 29);
  28. echo "test_bug_49081__10: ";
  29. examine_diff('2010-01-31', '2010-01-01', 'P+0Y0M30DT0H0M0S', 30);
  30. echo "test_bug_49081__11: ";
  31. examine_diff('2010-02-01', '2010-01-01', 'P+0Y1M0DT0H0M0S', 31);
  32. echo "test_bug_49081__12: ";
  33. examine_diff('2010-02-01', '2010-01-31', 'P+0Y0M1DT0H0M0S', 1);
  34. echo "test_bug_49081__13: ";
  35. examine_diff('2010-02-27', '2010-01-31', 'P+0Y0M27DT0H0M0S', 27);
  36. echo "test_bug_49081__14: ";
  37. examine_diff('2010-02-28', '2010-01-31', 'P+0Y0M28DT0H0M0S', 28);
  38. echo "test_bug_49081__15: ";
  39. examine_diff('2010-02-28', '2010-01-30', 'P+0Y0M29DT0H0M0S', 29);
  40. echo "test_bug_49081__16: ";
  41. examine_diff('2010-02-28', '2010-01-29', 'P+0Y0M30DT0H0M0S', 30);
  42. echo "test_bug_49081__17: ";
  43. examine_diff('2010-02-28', '2010-01-28', 'P+0Y1M0DT0H0M0S', 31);
  44. echo "test_bug_49081__18: ";
  45. examine_diff('2010-02-28', '2010-01-27', 'P+0Y1M1DT0H0M0S', 32);
  46. echo "test_bug_49081__19: ";
  47. examine_diff('2010-03-01', '2010-01-01', 'P+0Y2M0DT0H0M0S', 59);
  48. echo "test_bug_49081__20: ";
  49. examine_diff('2010-03-01', '2010-01-31', 'P+0Y0M29DT0H0M0S', 29);
  50. // NOTE: sub() produces different answer.
  51. echo "test_bug_49081__21: ";
  52. examine_diff('2010-03-27', '2010-01-31', 'P+0Y1M24DT0H0M0S', 55);
  53. // NOTE: sub() produces different answer.
  54. echo "test_bug_49081__22: ";
  55. examine_diff('2010-03-28', '2010-01-31', 'P+0Y1M25DT0H0M0S', 56);
  56. // NOTE: sub() produces different answer.
  57. echo "test_bug_49081__23: ";
  58. examine_diff('2010-03-29', '2010-01-31', 'P+0Y1M26DT0H0M0S', 57);
  59. // NOTE: sub() produces different answer.
  60. echo "test_bug_49081__24: ";
  61. examine_diff('2010-03-30', '2010-01-31', 'P+0Y1M27DT0H0M0S', 58);
  62. echo "test_bug_49081__25: ";
  63. examine_diff('2010-03-31', '2010-01-31', 'P+0Y2M0DT0H0M0S', 59);
  64. echo "test_bug_49081__26: ";
  65. examine_diff('2010-03-31', '2010-01-30', 'P+0Y2M1DT0H0M0S', 60);
  66. echo "test_bug_49081__27: ";
  67. examine_diff('2009-01-31', '2009-01-01', 'P+0Y0M30DT0H0M0S', 30);
  68. echo "test_bug_49081__28: ";
  69. examine_diff('2010-03-27', '2010-02-28', 'P+0Y0M27DT0H0M0S', 27);
  70. echo "test_bug_49081__29: ";
  71. examine_diff('2010-03-28', '2010-02-28', 'P+0Y1M0DT0H0M0S', 28);
  72. echo "test_bug_49081__30: ";
  73. examine_diff('2010-03-29', '2010-02-28', 'P+0Y1M1DT0H0M0S', 29);
  74. echo "test_bug_49081__31: ";
  75. examine_diff('2010-03-27', '2010-02-27', 'P+0Y1M0DT0H0M0S', 28);
  76. echo "test_bug_49081__32: ";
  77. examine_diff('2010-03-27', '2010-02-26', 'P+0Y1M1DT0H0M0S', 29);
  78. /*
  79. * Check PHP bug 49081, negative
  80. */
  81. echo "test_bug_49081_negative__1: ";
  82. examine_diff('2010-03-01', '2010-03-31', 'P-0Y0M30DT0H0M0S', 30);
  83. echo "test_bug_49081_negative__2: ";
  84. examine_diff('2010-03-01', '2010-04-01', 'P-0Y1M0DT0H0M0S', 31);
  85. echo "test_bug_49081_negative__3: ";
  86. examine_diff('2010-03-31', '2010-04-01', 'P-0Y0M1DT0H0M0S', 1);
  87. echo "test_bug_49081_negative__4: ";
  88. examine_diff('2010-03-31', '2010-04-29', 'P-0Y0M29DT0H0M0S', 29);
  89. echo "test_bug_49081_negative__5: ";
  90. examine_diff('2010-03-31', '2010-04-30', 'P-0Y0M30DT0H0M0S', 30);
  91. echo "test_bug_49081_negative__6: ";
  92. examine_diff('2010-03-30', '2010-04-30', 'P-0Y1M0DT0H0M0S', 31);
  93. echo "test_bug_49081_negative__7: ";
  94. examine_diff('2010-03-29', '2010-04-30', 'P-0Y1M1DT0H0M0S', 32);
  95. echo "test_bug_49081_negative__8: ";
  96. examine_diff('2010-01-01', '2010-01-29', 'P-0Y0M28DT0H0M0S', 28);
  97. echo "test_bug_49081_negative__9: ";
  98. examine_diff('2010-01-01', '2010-01-30', 'P-0Y0M29DT0H0M0S', 29);
  99. echo "test_bug_49081_negative__10: ";
  100. examine_diff('2010-01-01', '2010-01-31', 'P-0Y0M30DT0H0M0S', 30);
  101. echo "test_bug_49081_negative__11: ";
  102. examine_diff('2010-01-01', '2010-02-01', 'P-0Y1M0DT0H0M0S', 31);
  103. echo "test_bug_49081_negative__12: ";
  104. examine_diff('2010-01-31', '2010-02-01', 'P-0Y0M1DT0H0M0S', 1);
  105. echo "test_bug_49081_negative__13: ";
  106. examine_diff('2010-01-31', '2010-02-27', 'P-0Y0M27DT0H0M0S', 27);
  107. echo "test_bug_49081_negative__14: ";
  108. examine_diff('2010-01-31', '2010-02-28', 'P-0Y0M28DT0H0M0S', 28);
  109. echo "test_bug_49081_negative__15: ";
  110. examine_diff('2010-01-30', '2010-02-28', 'P-0Y0M29DT0H0M0S', 29);
  111. echo "test_bug_49081_negative__16: ";
  112. examine_diff('2010-01-29', '2010-02-28', 'P-0Y0M30DT0H0M0S', 30);
  113. echo "test_bug_49081_negative__17: ";
  114. examine_diff('2010-01-28', '2010-02-28', 'P-0Y1M0DT0H0M0S', 31);
  115. echo "test_bug_49081_negative__18: ";
  116. examine_diff('2010-01-27', '2010-02-28', 'P-0Y1M1DT0H0M0S', 32);
  117. echo "test_bug_49081_negative__19: ";
  118. examine_diff('2010-01-01', '2010-03-01', 'P-0Y2M0DT0H0M0S', 59);
  119. // NOTE: sub() produces different answer.
  120. echo "test_bug_49081_negative__20: ";
  121. examine_diff('2010-01-31', '2010-03-01', 'P-0Y1M1DT0H0M0S', 29);
  122. // NOTE: sub() produces different answer.
  123. echo "test_bug_49081_negative__21: ";
  124. examine_diff('2010-01-31', '2010-03-27', 'P-0Y1M27DT0H0M0S', 55);
  125. // NOTE: sub() produces different answer.
  126. echo "test_bug_49081_negative__22: ";
  127. examine_diff('2010-01-31', '2010-03-28', 'P-0Y1M28DT0H0M0S', 56);
  128. // NOTE: sub() produces different answer.
  129. echo "test_bug_49081_negative__23: ";
  130. examine_diff('2010-01-31', '2010-03-29', 'P-0Y1M29DT0H0M0S', 57);
  131. // NOTE: sub() produces different answer.
  132. echo "test_bug_49081_negative__24: ";
  133. examine_diff('2010-01-31', '2010-03-30', 'P-0Y1M30DT0H0M0S', 58);
  134. echo "test_bug_49081_negative__25: ";
  135. examine_diff('2010-01-31', '2010-03-31', 'P-0Y2M0DT0H0M0S', 59);
  136. echo "test_bug_49081_negative__26: ";
  137. examine_diff('2010-01-30', '2010-03-31', 'P-0Y2M1DT0H0M0S', 60);
  138. echo "test_bug_49081_negative__27: ";
  139. examine_diff('2009-01-01', '2009-01-31', 'P-0Y0M30DT0H0M0S', 30);
  140. echo "test_bug_49081_negative__28: ";
  141. examine_diff('2010-02-28', '2010-03-27', 'P-0Y0M27DT0H0M0S', 27);
  142. echo "test_bug_49081_negative__29: ";
  143. examine_diff('2010-02-28', '2010-03-28', 'P-0Y1M0DT0H0M0S', 28);
  144. echo "test_bug_49081_negative__30: ";
  145. examine_diff('2010-02-28', '2010-03-29', 'P-0Y1M1DT0H0M0S', 29);
  146. echo "test_bug_49081_negative__31: ";
  147. examine_diff('2010-02-27', '2010-03-27', 'P-0Y1M0DT0H0M0S', 28);
  148. echo "test_bug_49081_negative__32: ";
  149. examine_diff('2010-02-26', '2010-03-27', 'P-0Y1M1DT0H0M0S', 29);