From: Antony Dovgal Date: Thu, 28 Jun 2007 15:04:16 +0000 (+0000) Subject: more smaller tests X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~362 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6940afe0b424f4a57cb27ec508e0b8a0e7a4e6b;p=php more smaller tests --- diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt index f3399c1fc1..b281325ee7 100644 Binary files a/ext/standard/tests/array/array_values.phpt and b/ext/standard/tests/array/array_values.phpt differ diff --git a/ext/standard/tests/array/array_values_errors.phpt b/ext/standard/tests/array/array_values_errors.phpt new file mode 100644 index 0000000000..d72d565cb0 --- /dev/null +++ b/ext/standard/tests/array/array_values_errors.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test array_values() function (errors) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + expected +/* Invalid types */ +var_dump( array_values("") ); // Empty string +var_dump( array_values(100) ); // Integer +var_dump( array_values(new stdclass) ); // object + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_values() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, string given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, object given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing error conditions *** + +Warning: array_values() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: array_values() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, Unicode string given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, integer given in %s on line %d +NULL + +Warning: array_values() expects parameter 1 to be array, object given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_values_variation.phpt b/ext/standard/tests/array/array_values_variation.phpt new file mode 100644 index 0000000000..15da1a621e --- /dev/null +++ b/ext/standard/tests/array/array_values_variation.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test array_values() function (variation) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + $resource1, "b" => $resource2); +var_dump( array_values($arr_resource) ); + +echo "\n*** Testing array_values() with range checking ***\n"; +$arr_range = array( + 2147483647, + 2147483648, + -2147483647, + -2147483648, + -0, + 0, + -2147483649 +); +var_dump( array_values($arr_range) ); + +echo "\n*** Testing array_values() on an array created on the fly ***\n"; +var_dump( array_values(array(1,2,3)) ); +var_dump( array_values(array()) ); // null array + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing array_values() with resource type *** +array(2) { + [0]=> + resource(%d) of type (stream) + [1]=> + resource(%d) of type (stream) +} + +*** Testing array_values() with range checking *** +array(7) { + [0]=> + int(2147483647) + [1]=> + float(2147483648) + [2]=> + int(-2147483647) + [3]=> + float(-2147483648) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + float(-2147483649) +} + +*** Testing array_values() on an array created on the fly *** +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +} +Done diff --git a/ext/standard/tests/array/array_values_variation_64bit.phpt b/ext/standard/tests/array/array_values_variation_64bit.phpt new file mode 100644 index 0000000000..8b1e2c0b0e --- /dev/null +++ b/ext/standard/tests/array/array_values_variation_64bit.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test array_values() function +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + $resource1, "b" => $resource2); +var_dump( array_values($arr_resource) ); + +echo "\n*** Testing array_values() with range checking ***\n"; +$arr_range = array( + 2147483647, + 2147483648, + -2147483647, + -2147483648, + -0, + 0, + -2147483649 +); +var_dump( array_values($arr_range) ); + +echo "\n*** Testing array_values() on an array created on the fly ***\n"; +var_dump( array_values(array(1,2,3)) ); +var_dump( array_values(array()) ); // null array + +?> +--EXPECTF-- +*** Testing array_values() with resource type *** +array(2) { + [0]=> + resource(%d) of type (stream) + [1]=> + resource(%d) of type (stream) +} + +*** Testing array_values() with range checking *** +array(7) { + [0]=> + int(2147483647) + [1]=> + int(2147483648) + [2]=> + int(-2147483647) + [3]=> + int(-2147483648) + [4]=> + int(0) + [5]=> + int(0) + [6]=> + int(-2147483649) +} + +*** Testing array_values() on an array created on the fly *** +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(0) { +}