From: Raghubansh Kumar Date: Fri, 16 Nov 2007 17:52:26 +0000 (+0000) Subject: New testcases for sizeof() function X-Git-Tag: RELEASE_2_0_0a1~1355 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c78f2c08b355139909a51e1405593b10a6b9858;p=php New testcases for sizeof() function --- diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt new file mode 100644 index 0000000000..34b22f2f85 --- /dev/null +++ b/ext/standard/tests/array/sizeof_basic1.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test sizeof() function : basic functionality - for scalar types +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : basic functionality *** +-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) + +-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) +Done +--UEXPECTF-- +*** Testing sizeof() : basic functionality *** +-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) + +-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes -- +default mode: int(1) + +COUNT_NORMAL mode: int(1) + +COUNT_RECURSIVE mode: int(1) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/sizeof_basic2.phpt b/ext/standard/tests/array/sizeof_basic2.phpt new file mode 100644 index 0000000000..043114ae93 --- /dev/null +++ b/ext/standard/tests/array/sizeof_basic2.phpt @@ -0,0 +1,129 @@ +--TEST-- +Test sizeof() function : basic functionality - for non-scalar type(array) +--FILE-- + "Saffron", "Peace" => "White", "Growth" => "Green"); +$mixed_array = array(1, 2, "Aggression" => "Saffron", 10 => "Ten", "Ten" => 10); + +echo "-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($int_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($int_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($int_array, COUNT_RECURSIVE) ); +echo "\n"; + +echo "-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($string_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($string_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($string_array, COUNT_RECURSIVE) ); +echo "\n"; + +echo "-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($indexed_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($indexed_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($indexed_array, COUNT_RECURSIVE) ); +echo "\n"; + +echo "-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n"; +echo "default mode: "; +var_dump( sizeof($mixed_array) ); +echo "\n"; +echo "COUNT_NORMAL mode: "; +var_dump( sizeof($mixed_array, COUNT_NORMAL) ); +echo "\n"; +echo "COUNT_RECURSIVE mode: "; +var_dump( sizeof($mixed_array, COUNT_RECURSIVE) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing sizeof() : basic functionality *** +-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(4) + +COUNT_NORMAL mode: int(4) + +COUNT_RECURSIVE mode: int(4) + +-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(3) + +COUNT_NORMAL mode: int(3) + +COUNT_RECURSIVE mode: int(3) + +-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(3) + +COUNT_NORMAL mode: int(3) + +COUNT_RECURSIVE mode: int(3) + +-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(5) + +COUNT_NORMAL mode: int(5) + +COUNT_RECURSIVE mode: int(5) +Done +--UEXPECTF-- +*** Testing sizeof() : basic functionality *** +-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(4) + +COUNT_NORMAL mode: int(4) + +COUNT_RECURSIVE mode: int(4) + +-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(3) + +COUNT_NORMAL mode: int(3) + +COUNT_RECURSIVE mode: int(3) + +-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(3) + +COUNT_NORMAL mode: int(3) + +COUNT_RECURSIVE mode: int(3) + +-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes -- +default mode: int(5) + +COUNT_NORMAL mode: int(5) + +COUNT_RECURSIVE mode: int(5) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/sizeof_error.phpt b/ext/standard/tests/array/sizeof_error.phpt new file mode 100644 index 0000000000..94d6ed4c1f --- /dev/null +++ b/ext/standard/tests/array/sizeof_error.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test sizeof() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : error conditions *** +-- Testing sizeof() with zero arguments -- + +Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d +NULL +-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode -- + +Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d +NULL +-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode -- + +Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing sizeof() : error conditions *** +-- Testing sizeof() with zero arguments -- + +Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d +NULL +-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode -- + +Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d +NULL +-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode -- + +Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/sizeof_object1.phpt b/ext/standard/tests/array/sizeof_object1.phpt new file mode 100644 index 0000000000..cd0eb92600 --- /dev/null +++ b/ext/standard/tests/array/sizeof_object1.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test sizeof() function : objects - object with Countable interface +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing sizeof() with object functionality *** +-- Testing sizeof() with an object which implements Countable interface -- +-- Testing sizeof() in default mode -- +int(3) +-- Testing sizeof() in COUNT_NORMAL mode -- +int(3) +-- Testing sizeof() in COUNT_RECURSIVE mode -- +int(3) +Done +--UEXPECTF-- +*** Testing sizeof() with object functionality *** +-- Testing sizeof() with an object which implements Countable interface -- +-- Testing sizeof() in default mode -- +int(3) +-- Testing sizeof() in COUNT_NORMAL mode -- +int(3) +-- Testing sizeof() in COUNT_RECURSIVE mode -- +int(3) +Done diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt new file mode 100644 index 0000000000..723d710c41 --- /dev/null +++ b/ext/standard/tests/array/sizeof_object2.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test sizeof() function : object functionality - objects without Countable interface +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : object functionality *** +--- Testing sizeof() with objects which doesn't implement Countable interface --- +-- Iteration 1 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 2 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 3 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 4 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 5 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +Done +--UEXPECTF-- +*** Testing sizeof() : object functionality *** +--- Testing sizeof() with objects which doesn't implement Countable interface --- +-- Iteration 1 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 2 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 3 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 4 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 5 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +Done diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt new file mode 100644 index 0000000000..af00acac75 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation1.phpt @@ -0,0 +1,352 @@ +--TEST-- +Test sizeof() function : usage variations - for all scalar types and resource variable +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode --- +-- Iteration 1 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 2 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 3 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 4 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 5 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 6 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 7 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 8 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 9 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 10 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 11 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 12 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 13 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 14 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 15 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 16 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 17 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 18 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 19 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +Done +--UEXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode --- +-- Iteration 1 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 2 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 3 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 4 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 5 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 6 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 7 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 8 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 9 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 10 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 11 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 12 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 13 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 14 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 15 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 16 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 17 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +-- Iteration 18 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 19 -- +Default Mode: int(1) + +COUNT_NORMAL Mode: int(1) + +COUNT_RECURSIVE Mode: int(1) + +Done \ No newline at end of file diff --git a/ext/standard/tests/array/sizeof_variation2.phpt b/ext/standard/tests/array/sizeof_variation2.phpt new file mode 100644 index 0000000000..6febf4d583 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation2.phpt @@ -0,0 +1,265 @@ +--TEST-- +Test sizeof() function : usage variations - different array values for 'var' argument +--FILE-- + $fp), + array(1, array(3, 4, array(6, array(8)))), + array("a" => 1, 'b' => 2, array( "c" =>3, array( "d" => 5))), + array(), + /* 5 */ array(1, 2, 3, 4), + array("Saffron", "White", "Green"), + array('saffron', 'white', 'green'), + array(1 => "Hi", 2 => "Hello" ), + array("color" => "red", "item" => "pen"), + /* 10 */ array('color' => 'red', 'item' => 'pen'), + array(TRUE => "red", FALSE => "pen" ), + array(false => 'red', true => 'pen' ), + array('color' => "red", "item" => 'pen', 1 => "Hi", "" => "Hello" ), + /* 14 */ array($fp, "resource1" => $fp, 'resource2' => $fp, array( $fp, 'type' => $fp) ) +); + +// loop through each element of the values array for 'var' argument +// check the working of sizeof() +$counter = 1; +for($i = 0; $i < count($values); $i++) +{ + echo "-- Iteration $counter --\n"; + $var = $values[$i]; + + echo "Default Mode: "; + var_dump( sizeof($var) ); + echo "\n"; + + echo "COUNT_NORMAL Mode: "; + var_dump( sizeof($var, COUNT_NORMAL) ); + echo "\n"; + + echo "COUNT_RECURSIVE Mode: "; + var_dump( sizeof($var, COUNT_RECURSIVE) ); + echo "\n"; + + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() with different array values for 'var' argument --- +-- Iteration 1 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 2 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(8) + +-- Iteration 3 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(6) + +-- Iteration 4 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 5 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(4) + +-- Iteration 6 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(3) + +-- Iteration 7 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(3) + +-- Iteration 8 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 9 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 10 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 11 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 12 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 13 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(4) + +-- Iteration 14 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(6) + +Done +--UEXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() with different array values for 'var' argument --- +-- Iteration 1 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 2 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(8) + +-- Iteration 3 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(6) + +-- Iteration 4 -- +Default Mode: int(0) + +COUNT_NORMAL Mode: int(0) + +COUNT_RECURSIVE Mode: int(0) + +-- Iteration 5 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(4) + +-- Iteration 6 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(3) + +-- Iteration 7 -- +Default Mode: int(3) + +COUNT_NORMAL Mode: int(3) + +COUNT_RECURSIVE Mode: int(3) + +-- Iteration 8 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 9 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 10 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 11 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 12 -- +Default Mode: int(2) + +COUNT_NORMAL Mode: int(2) + +COUNT_RECURSIVE Mode: int(2) + +-- Iteration 13 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(4) + +-- Iteration 14 -- +Default Mode: int(4) + +COUNT_NORMAL Mode: int(4) + +COUNT_RECURSIVE Mode: int(6) + +Done \ No newline at end of file diff --git a/ext/standard/tests/array/sizeof_variation3.phpt b/ext/standard/tests/array/sizeof_variation3.phpt new file mode 100644 index 0000000000..f8bc84b6e6 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation3.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test sizeof() function : usage variations - checking for infinite recursion in COUNT_RECURSIVE mode +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode -- +int(13) + +int(2) +Done +--UEXPECTF-- +*** Testing sizeof() : usage variations *** +-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode -- +int(13) + +int(2) +Done \ No newline at end of file diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt new file mode 100644 index 0000000000..f460712e97 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation4.phpt @@ -0,0 +1,614 @@ +--TEST-- +Test sizeof() function : usage variations - all kinds of unset variables for 'var' argument +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes --- +-- Iteration 1 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 2 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 3 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 4 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 5 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 6 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 7 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 8 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 9 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 10 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 11 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 12 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 13 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 14 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 15 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 16 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 17 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 18 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 19 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 20 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +Done +--UEXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes --- +-- Iteration 1 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 2 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 3 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 4 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 5 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 6 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 7 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 8 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 9 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 10 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 11 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 12 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 13 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 14 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 15 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 16 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 17 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 18 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 19 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +-- Iteration 20 -- +Default Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_NORMAL Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +COUNT_RECURSIVE Mode: +Notice: Undefined variable: value in %s on line %d +int(0) + +Done diff --git a/ext/standard/tests/array/sizeof_variation5.phpt b/ext/standard/tests/array/sizeof_variation5.phpt new file mode 100644 index 0000000000..cd8f73cc30 --- /dev/null +++ b/ext/standard/tests/array/sizeof_variation5.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test sizeof() function : usage variations - different values for 'mode' argument +--FILE-- + +--EXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() with different values for 'mode' argument --- +-- Iteration 1 -- +int(6) +-- Iteration 2 -- +int(9) +-- Iteration 3 -- +int(6) +-- Iteration 4 -- +int(9) +-- Iteration 5 -- +int(9) +-- Iteration 6 -- +int(9) +-- Iteration 7 -- +int(6) +-- Iteration 8 -- +int(6) +-- Iteration 9 -- +int(6) +-- Iteration 10 -- +int(6) +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- +int(6) +-- Iteration 16 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- +int(6) +-- Iteration 21 -- + +Warning: sizeof() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: sizeof() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing sizeof() : usage variations *** +--- Testing sizeof() with different values for 'mode' argument --- +-- Iteration 1 -- +int(6) +-- Iteration 2 -- +int(9) +-- Iteration 3 -- +int(6) +-- Iteration 4 -- +int(9) +-- Iteration 5 -- +int(9) +-- Iteration 6 -- +int(9) +-- Iteration 7 -- +int(6) +-- Iteration 8 -- +int(6) +-- Iteration 9 -- +int(6) +-- Iteration 10 -- +int(6) +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- +int(6) +-- Iteration 16 -- + +Warning: sizeof() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: sizeof() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: sizeof() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: sizeof() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL +-- Iteration 20 -- +int(6) +-- Iteration 21 -- + +Warning: sizeof() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: sizeof() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done