summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmb@php.net>2016-07-28 19:59:14 +0200
committerChristoph M. Becker <cmb@php.net>2016-07-28 19:59:14 +0200
commit5c458c9b025f6f654497f5e3d2ee53b4d1561454 (patch)
treedba15ee05590402d55579665c7e5549766004585
parent7ab39e2faef499c8a1857205fa332d2e38a0a584 (diff)
downloadphp-git-5c458c9b025f6f654497f5e3d2ee53b4d1561454.tar.gz
Implement FR #65462: Please add tests for gregorian and jewish overflow fixes
-rw-r--r--ext/calendar/tests/jdtogregorian_overflow.phpt28
-rw-r--r--ext/calendar/tests/jdtojewish_overflow.phpt27
2 files changed, 55 insertions, 0 deletions
diff --git a/ext/calendar/tests/jdtogregorian_overflow.phpt b/ext/calendar/tests/jdtogregorian_overflow.phpt
new file mode 100644
index 0000000000..28f5298e19
--- /dev/null
+++ b/ext/calendar/tests/jdtogregorian_overflow.phpt
@@ -0,0 +1,28 @@
+--TEST--
+jdtogregorian(): test overflow
+--CREDITS--
+neweracracker@gmail.com
+--SKIPIF--
+<?php
+if (!extension_loaded('calendar')) die('skip ext/calendar required');
+if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only');
+?>
+--FILE--
+<?php
+for ($i=536838860; $i<536838870; $i++) {
+ echo $i, ':', jdtogregorian($i), PHP_EOL;
+}
+echo 'DONE', PHP_EOL;
+?>
+--EXPECT--
+536838860:10/11/1465102
+536838861:10/12/1465102
+536838862:10/13/1465102
+536838863:10/14/1465102
+536838864:10/15/1465102
+536838865:10/16/1465102
+536838866:10/17/1465102
+536838867:0/0/0
+536838868:0/0/0
+536838869:0/0/0
+DONE
diff --git a/ext/calendar/tests/jdtojewish_overflow.phpt b/ext/calendar/tests/jdtojewish_overflow.phpt
new file mode 100644
index 0000000000..1d1c2eefb9
--- /dev/null
+++ b/ext/calendar/tests/jdtojewish_overflow.phpt
@@ -0,0 +1,27 @@
+--TEST--
+jdtojewish(): test overflow
+--CREDITS--
+neweracracker@gmail.com
+--SKIPIF--
+<?php
+if (!extension_loaded('calendar')) die('skip ext/calendar required');
+?>
+--FILE--
+<?php
+for ($i=324542840; $i<324542850; $i++) {
+ echo $i, ':', jdtojewish($i), PHP_EOL;
+}
+echo 'DONE', PHP_EOL;
+?>
+--EXPECT--
+324542840:12/7/887605
+324542841:12/8/887605
+324542842:12/9/887605
+324542843:12/10/887605
+324542844:12/11/887605
+324542845:12/12/887605
+324542846:12/13/887605
+324542847:0/0/0
+324542848:0/0/0
+324542849:0/0/0
+DONE