]> granicus.if.org Git - php/commitdiff
Implement FR #65462: Please add tests for gregorian and jewish overflow fixes
authorChristoph M. Becker <cmb@php.net>
Thu, 28 Jul 2016 17:59:14 +0000 (19:59 +0200)
committerChristoph M. Becker <cmb@php.net>
Thu, 28 Jul 2016 17:59:14 +0000 (19:59 +0200)
ext/calendar/tests/jdtogregorian_overflow.phpt [new file with mode: 0644]
ext/calendar/tests/jdtojewish_overflow.phpt [new file with mode: 0644]

diff --git a/ext/calendar/tests/jdtogregorian_overflow.phpt b/ext/calendar/tests/jdtogregorian_overflow.phpt
new file mode 100644 (file)
index 0000000..28f5298
--- /dev/null
@@ -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 (file)
index 0000000..1d1c2ee
--- /dev/null
@@ -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