cvs: php4 /ext/standard/tests/array count_recursive.phpt
| From: | Derick Rethans | Date: | Sat, 29 Dec 2001 21:05:03 +0000 |
| Subject: | cvs: php4 /ext/standard/tests/array count_recursive.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-8848@lists.php.net to get a copy of this message | ||
derick Sat Dec 29 16:05:03 2001 EDT
Added files:
/php4/ext/standard/tests/array count_recursive.phpt
Log:
- Added test for recursive counting
Index: php4/ext/standard/tests/array/count_recursive.phpt
+++ php4/ext/standard/tests/array/count_recursive.phpt
--TEST--
count
--POST--
--GET--
--FILE--
<?php
print "Testing arrays...\n";
$arr = array(1, array(3, 4, array(6, array(8))));
print "COUNT_NORMAL: should be 2, is ".count($arr, COUNT_NORMAL)."\n";
print "COUNT_RECURSIVE: should be 8, is ".count($arr, COUNT_RECURSIVE)."\n";
print "Testing hashes...\n";
$arr = array("a" => 1, "b" => 2, array("c" => 3,
array("d" => 5)));
print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n";
print "COUNT_RECURSIVE: should be 6, is ".count($arr, COUNT_RECURSIVE)."\n";
print "Testing strings...\n";
print "COUNT_NORMAL: should be 1, is ".count("string",
COUNT_NORMAL)."\n";
print "COUNT_RECURSIVE: should be 1, is ".count("string",
COUNT_RECURSIVE)."\n";
print "Testing various types with no second argument.\n";
print "COUNT_NORMAL: should be 1, is ".count("string")."\n";
print "COUNT_NORMAL: should be 2, is ".count(array("a",
array("b")))."\n";
?>
--EXPECT--
Testing arrays...
COUNT_NORMAL: should be 2, is 2
COUNT_RECURSIVE: should be 8, is 8
Testing hashes...
COUNT_NORMAL: should be 3, is 3
COUNT_RECURSIVE: should be 6, is 6
Testing strings...
COUNT_NORMAL: should be 1, is 1
COUNT_RECURSIVE: should be 1, is 1
Testing various types with no second argument.
COUNT_NORMAL: should be 1, is 1
COUNT_NORMAL: should be 2, is 2