From: Josie Messa Date: Thu, 14 Feb 2008 16:49:58 +0000 (+0000) Subject: - New tests for count() function X-Git-Tag: RELEASE_1_3_1~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0430464b1157355277562c058451be86398155cf;p=php - New tests for count() function --- diff --git a/ext/standard/tests/array/count_basic.phpt b/ext/standard/tests/array/count_basic.phpt new file mode 100644 index 0000000000..45f63d6a49 --- /dev/null +++ b/ext/standard/tests/array/count_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test count() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing count() : basic functionality *** + +-- One Dimensional Array: -- +int(3) + +-- Two Dimensional Array: -- +$mode = COUNT_NORMAL: int(3) +$mode = 0: int(3) +$mode = COUNT_RECURSIVE: int(6) +$mode = 1: int(6) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_error.phpt b/ext/standard/tests/array/count_error.phpt new file mode 100644 index 0000000000..76f7213645 --- /dev/null +++ b/ext/standard/tests/array/count_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test count() function : error conditions - pass incorrect number of args +--FILE-- + +--EXPECTF-- +*** Testing count() : error conditions *** + +-- Testing count() function with Zero arguments -- + +Warning: count() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing count() function with more than expected no. of arguments -- + +Warning: count() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_variation1.phpt b/ext/standard/tests/array/count_variation1.phpt new file mode 100644 index 0000000000..b40a2ab299 --- /dev/null +++ b/ext/standard/tests/array/count_variation1.phpt @@ -0,0 +1,170 @@ +--TEST-- +Test count() function : usage variations - Pass different data types as $var arg +--FILE-- + +--EXPECTF-- +*** Testing count() : usage variations *** + +-- Iteration 1 -- +int(1) + +-- Iteration 2 -- +int(1) + +-- Iteration 3 -- +int(1) + +-- Iteration 4 -- +int(1) + +-- Iteration 5 -- +int(1) + +-- Iteration 6 -- +int(1) + +-- Iteration 7 -- +int(1) + +-- Iteration 8 -- +int(1) + +-- Iteration 9 -- +int(1) + +-- Iteration 10 -- +int(0) + +-- Iteration 11 -- +int(0) + +-- Iteration 12 -- +int(1) + +-- Iteration 13 -- +int(1) + +-- Iteration 14 -- +int(1) + +-- Iteration 15 -- +int(1) + +-- Iteration 16 -- +int(1) + +-- Iteration 17 -- +int(1) + +-- Iteration 18 -- +int(1) + +-- Iteration 19 -- +int(1) + +-- Iteration 20 -- +int(1) + +-- Iteration 21 -- +int(1) + +-- Iteration 22 -- +int(0) + +-- Iteration 23 -- +int(0) + +-- Iteration 24 -- +int(1) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_variation2.phpt b/ext/standard/tests/array/count_variation2.phpt new file mode 100644 index 0000000000..86aecc07b1 --- /dev/null +++ b/ext/standard/tests/array/count_variation2.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test count() function : usage variations - Pass different data types as $mode arg +--FILE-- + +--EXPECTF-- +*** Testing count() : usage variations *** + +-- Iteration 1 -- +int(3) + +-- Iteration 2 -- +int(5) + +-- Iteration 3 -- +int(3) + +-- Iteration 4 -- +int(3) + +-- Iteration 5 -- +int(3) + +-- Iteration 6 -- +int(3) + +-- Iteration 7 -- +int(3) + +-- Iteration 8 -- +int(3) + +-- Iteration 9 -- +int(3) + +-- Iteration 10 -- +int(3) + +-- Iteration 11 -- +int(3) + +-- Iteration 12 -- +int(5) + +-- Iteration 13 -- +int(3) + +-- Iteration 14 -- +int(5) + +-- Iteration 15 -- +int(3) + +-- Iteration 16 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: count() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: count() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 22 -- +int(3) + +-- Iteration 23 -- +int(3) + +-- Iteration 24 -- + +Warning: count() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/array/count_variation3.phpt b/ext/standard/tests/array/count_variation3.phpt new file mode 100644 index 0000000000..2d79bb9ceb --- /dev/null +++ b/ext/standard/tests/array/count_variation3.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test count() function : usage variations - Infinitely recursive array +--FILE-- + +--EXPECTF-- +*** Testing count() : usage variations *** + +-- $mode not set: -- +int(4) + +-- $mode = 1: -- \ No newline at end of file