]> granicus.if.org Git - php/commitdiff
Tests for calendar extension
authorRathna N <nrathna@php.net>
Thu, 27 Oct 2005 11:05:50 +0000 (11:05 +0000)
committerRathna N <nrathna@php.net>
Thu, 27 Oct 2005 11:05:50 +0000 (11:05 +0000)
ext/calendar/tests/cal_days_in_month.phpt [new file with mode: 0644]
ext/calendar/tests/cal_to_jd.phpt [new file with mode: 0644]
ext/calendar/tests/easter_days.phpt [new file with mode: 0644]
ext/calendar/tests/frenchtojd.phpt [new file with mode: 0644]
ext/calendar/tests/skipif.inc [new file with mode: 0644]

diff --git a/ext/calendar/tests/cal_days_in_month.phpt b/ext/calendar/tests/cal_days_in_month.phpt
new file mode 100644 (file)
index 0000000..71fe98f
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+cal_days_in_month()
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003); 
+echo "There are $num days in August 2003\n";
+$num = cal_days_in_month(CAL_GREGORIAN, 2, 2003); 
+echo "There are $num days in February 2003\n";
+$num = cal_days_in_month(CAL_GREGORIAN, 2, 2004); 
+echo "There are $num days in February 2004\n";
+$num = cal_days_in_month(CAL_GREGORIAN, -1, -2003); 
+echo "There are $num days in -1, -2003\n";
+$num = cal_days_in_month(CAL_GREGORIAN, 12, 2034); 
+echo "There are $num days in December 2034\n";
+?>
+--EXPECT--
+There are 31 days in August 2003
+There are 28 days in February 2003
+There are 29 days in February 2004
+There are 990210 days in -1, -2003
+There are 31 days in December 2034
diff --git a/ext/calendar/tests/cal_to_jd.phpt b/ext/calendar/tests/cal_to_jd.phpt
new file mode 100644 (file)
index 0000000..fde1e0b
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+cal_to_jd()
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+echo cal_to_jd(CAL_GREGORIAN, 8, 26, 74), "\n";
+echo cal_to_jd(CAL_JULIAN, 8, 26, 74), "\n";
+echo cal_to_jd(CAL_JEWISH, 8, 26, 74), "\n";
+echo cal_to_jd(CAL_FRENCH, 8, 26, 74), "\n";
+?>
+--EXPECT--
+1748326
+1748324
+374867
+0
diff --git a/ext/calendar/tests/easter_days.phpt b/ext/calendar/tests/easter_days.phpt
new file mode 100644 (file)
index 0000000..04aa7ae
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+easter_days()
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+echo easter_days(1999), "\n";
+echo easter_days(1492), "\n";
+echo easter_days(1913), "\n";
+?>
+--EXPECT--
+14
+32
+2
diff --git a/ext/calendar/tests/frenchtojd.phpt b/ext/calendar/tests/frenchtojd.phpt
new file mode 100644 (file)
index 0000000..73addb6
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+frenchtojd()
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+echo frenchtojd(-1,-1,-1), "\n";
+echo frenchtojd(0,0,0), "\n";
+echo frenchtojd(1,1,1), "\n";
+echo frenchtojd(14,31,15), "\n";
+?>
+--EXPECT--
+0
+0
+2375840
+0
diff --git a/ext/calendar/tests/skipif.inc b/ext/calendar/tests/skipif.inc
new file mode 100644 (file)
index 0000000..fbc18a4
--- /dev/null
@@ -0,0 +1,16 @@
+<?php 
+if(!extension_loaded("calendar")) 
+       print "skip - CALENDAR extension not available"; 
+?>
+<?php 
+if(!extension_loaded("calendar")) 
+       print "skip - CALENDAR extension not available"; 
+?>
+<?php 
+if(!extension_loaded("calendar")) 
+       print "skip - CALENDAR extension not available"; 
+?>
+<?php 
+if(!extension_loaded("calendar")) 
+       print "skip - CALENDAR extension not available"; 
+?>