--- /dev/null
+--TEST--
+Test get_extension_funcs() function: basic test
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for get_extension_funcs() function\n";
+
+$result = get_extension_funcs("standard");
+var_dump(gettype($result));
+var_dump(in_array("cos", $result));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_extension_funcs() function
+string(5) "array"
+bool(true)
+===DONE===
--- /dev/null
+--TEST--
+Test get_extension_funcs() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_extension_funcs() : error conditions ***\n";
+
+echo "\n-- Too few arguments --\n";
+var_dump(get_extension_funcs());
+
+$extra_arg = 1;
+echo "\n-- Too many arguments --\n";
+var_dump(get_extension_funcs("standard", $extra_arg));
+
+echo "\n-- Invalid extension name --\n";
+var_dump(get_extension_funcs("foo"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_extension_funcs() : error conditions ***
+
+-- Too few arguments --
+
+Warning: Wrong parameter count for get_extension_funcs() in %s on line %d
+NULL
+
+-- Too many arguments --
+
+Warning: Wrong parameter count for get_extension_funcs() in %s on line %d
+NULL
+
+-- Invalid extension name --
+bool(false)
+===DONE===
--- /dev/null
+--TEST--
+Test get_extension_funcs() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $str
+$inputs = array (
+
+ // integer values
+ 0,
+ 1,
+ 255,
+ 256,
+ PHP_INT_MAX,
+ -PHP_INT_MAX,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test get_extension_funcs() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( get_extension_funcs($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
--- /dev/null
+--TEST--
+Test getrusage() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for getrusage() function\n";
+
+$dat = getrusage();
+
+if (!is_array($dat)) {
+ echo "TEST FAILED : getrusage shoudl return an array\n";
+}
+
+// echo the fields which are common to all platforms
+echo "User time used (seconds) " . $dat["ru_utime.tv_sec"] . "\n";
+echo "User time used (microseconds) " . $dat["ru_utime.tv_usec"] . "\n";
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for getrusage() function
+User time used (seconds) %d
+User time used (microseconds) %d
+===DONE===
--- /dev/null
+--TEST--
+Test getrusage() function : error conditions - incorrect number of args
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass an incorrect number of arguments to getrusage() to test behaviour
+ */
+
+echo "*** Testing getrusage() : error conditions ***\n";
+
+echo "\n-- Testing getrusage() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+$dat = getrusage(1, $extra_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - non-numeric STRING--\n";
+$string_arg = "foo";
+$dat = getrusage($string_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - ARRAY--\n";
+$array_arg = array(1,2,3);
+$dat = getrusage($array_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - OBJECT --\n";
+class classA
+{
+ function __toString() {
+ return "ClassAObject";
+ }
+}
+$obj_arg = new classA();
+$dat = getrusage($obj_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - RESOURCE --\n";
+$file_handle=fopen(__FILE__, "r");
+$dat = getrusage($file_handle);
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getrusage() : error conditions ***
+
+-- Testing getrusage() function with more than expected no. of arguments --
+
+Warning: getrusage() expects at most 1 parameter, 2 given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - non-numeric STRING--
+
+Warning: getrusage() expects parameter 1 to be long, string given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - ARRAY--
+
+Warning: getrusage() expects parameter 1 to be long, array given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - OBJECT --
+
+Warning: getrusage() expects parameter 1 to be long, object given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - RESOURCE --
+
+Warning: getrusage() expects parameter 1 to be long, resource given in %s on line %d
+===DONE===
--- /dev/null
+--TEST--
+Test getrusage() function : usage variation - diff data types as $who arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+
+/*
+ * Pass different data types as $who argument to test behaviour of getrusage()
+ */
+
+echo "*** Testing getrusage() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// unexpected values to be passed to $stream_id argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string data
+/*16*/ "0",
+ '1',
+ "1232456",
+ "1.23E4",
+
+ // undefined data
+/*20*/ @$undefined_var,
+
+ // unset data
+/*21*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of getrusage()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $res = getrusage($input);
+ echo "User time used (microseconds) " . $res["ru_utime.tv_usec"] . "\n";
+ $iterator++;
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing getrusage() : usage variations ***
+
+-- Iteration 1 --
+User time used (microseconds) %d
+
+-- Iteration 2 --
+User time used (microseconds) %d
+
+-- Iteration 3 --
+User time used (microseconds) %d
+
+-- Iteration 4 --
+User time used (microseconds) %d
+
+-- Iteration 5 --
+User time used (microseconds) %d
+
+-- Iteration 6 --
+User time used (microseconds) %d
+
+-- Iteration 7 --
+User time used (microseconds) %d
+
+-- Iteration 8 --
+User time used (microseconds) %d
+
+-- Iteration 9 --
+User time used (microseconds) %d
+
+-- Iteration 10 --
+User time used (microseconds) %d
+
+-- Iteration 11 --
+User time used (microseconds) %d
+
+-- Iteration 12 --
+User time used (microseconds) %d
+
+-- Iteration 13 --
+User time used (microseconds) %d
+
+-- Iteration 14 --
+User time used (microseconds) %d
+
+-- Iteration 15 --
+User time used (microseconds) %d
+
+-- Iteration 16 --
+User time used (microseconds) %d
+
+-- Iteration 17 --
+User time used (microseconds) %d
+
+-- Iteration 18 --
+User time used (microseconds) %d
+
+-- Iteration 19 --
+User time used (microseconds) %d
+
+-- Iteration 20 --
+User time used (microseconds) %d
+
+-- Iteration 21 --
+User time used (microseconds) %d
+===DONE===