diff options
author | Rathna N <nrathna@php.net> | 2005-10-27 11:05:50 +0000 |
---|---|---|
committer | Rathna N <nrathna@php.net> | 2005-10-27 11:05:50 +0000 |
commit | ced39e31684f5df22e070237ac7b25fcd0418a77 (patch) | |
tree | 8eddaf18b02cf32e93953d3bcb2bf98b2a156674 /ext/calendar/tests | |
parent | dcd78795566cbf4eacd46f9e4221d3ddf2b57524 (diff) | |
download | php-git-ced39e31684f5df22e070237ac7b25fcd0418a77.tar.gz |
Tests for calendar extension
Diffstat (limited to 'ext/calendar/tests')
-rw-r--r-- | ext/calendar/tests/cal_days_in_month.phpt | 23 | ||||
-rw-r--r-- | ext/calendar/tests/cal_to_jd.phpt | 16 | ||||
-rw-r--r-- | ext/calendar/tests/easter_days.phpt | 14 | ||||
-rw-r--r-- | ext/calendar/tests/frenchtojd.phpt | 16 | ||||
-rw-r--r-- | ext/calendar/tests/skipif.inc | 16 |
5 files changed, 85 insertions, 0 deletions
diff --git a/ext/calendar/tests/cal_days_in_month.phpt b/ext/calendar/tests/cal_days_in_month.phpt new file mode 100644 index 0000000000..71fe98f0b7 --- /dev/null +++ b/ext/calendar/tests/cal_days_in_month.phpt @@ -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 index 0000000000..fde1e0b455 --- /dev/null +++ b/ext/calendar/tests/cal_to_jd.phpt @@ -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 index 0000000000..04aa7ae11b --- /dev/null +++ b/ext/calendar/tests/easter_days.phpt @@ -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 index 0000000000..73addb6b80 --- /dev/null +++ b/ext/calendar/tests/frenchtojd.phpt @@ -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 index 0000000000..fbc18a41e0 --- /dev/null +++ b/ext/calendar/tests/skipif.inc @@ -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"; +?> |