--- /dev/null
+--TEST--
+Test log1p() - basic function test log1p()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : basic functionality ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+echo "\n LOG1p tests\n";
+
+foreach($values as $value) {
+ echo "\n-- log1p $value --\n";
+ var_dump(log1p($value));
+};
+
+
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : basic functionality ***
+
+ LOG1p tests
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p -23 --
+float(NAN)
+
+-- log1p 23.45 --
+float(3.1966302159209)
+
+-- log1p -23.45 --
+float(NAN)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23.45 --
+float(3.1966302159209)
+
+-- log1p 2.345e1 --
+float(3.1966302159209)
+
+-- log1p --
+float(0)
+
+-- log1p 1 --
+float(0.69314718055995)
+
+-- log1p --
+float(0)
+===Done===
--- /dev/null
+--TEST--
+Test log1p() - Error conditions
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : error conditions ***\n";
+
+echo "\n-- Testing log1p() function with less than expected no. of arguments --\n";
+log1p();
+echo "\n-- Testing log1p() function with more than expected no. of arguments --\n";
+log1p(36, true);
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : error conditions ***
+
+-- Testing log1p() function with less than expected no. of arguments --
+
+Warning: log1p() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing log1p() function with more than expected no. of arguments --
+
+Warning: log1p() expects exactly 1 parameter, 2 given in %s on line %d
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test log1p() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+ -2147483648,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789E4,
+ 12.3456789E-4,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log1p()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log1p($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0.69314718055995)
+
+-- Iteration 3 --
+float(9.4210874029538)
+
+-- Iteration 4 --
+float(NAN)
+
+-- Iteration 5 --
+float(21.487562597358)
+
+-- Iteration 6 --
+float(NAN)
+
+-- Iteration 7 --
+float(2.4423470353692)
+
+-- Iteration 8 --
+float(NAN)
+
+-- Iteration 9 --
+float(11.723654587153)
+
+-- Iteration 10 --
+float(0.0012338064377078)
+
+-- Iteration 11 --
+float(0.40546510810816)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(0.69314718055995)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(0.69314718055995)
+
+-- Iteration 17 --
+float(0)
+
+-- Iteration 18 --
+
+Warning: log1p() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log1p() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log1p() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log1p() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log1p() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log1p() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: log1p() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(0)
+
+-- Iteration 27 --
+
+Warning: log1p() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test log() function : usage variations - different data types as $arg argument
+--FILE--
+<?php
+/* Prototype : float log ( float $arg [, float $base ] )
+ * Description: Natural logarithm.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log($input, 10));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log() : usage variations ***
+
+-- Iteration 1 --
+float(-INF)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(4.091491094268)
+
+-- Iteration 4 --
+float(NAN)
+
+-- Iteration 5 --
+float(9.3319298653812)
+
+-- Iteration 6 --
+float(1.0211892990699)
+
+-- Iteration 7 --
+float(NAN)
+
+-- Iteration 8 --
+float(11.091514977169)
+
+-- Iteration 9 --
+float(-8.9084850228307)
+
+-- Iteration 10 --
+float(-0.30102999566398)
+
+-- Iteration 11 --
+float(-INF)
+
+-- Iteration 12 --
+float(-INF)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(-INF)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(-INF)
+
+-- Iteration 17 --
+
+Warning: log() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: log() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(-INF)
+
+-- Iteration 25 --
+float(-INF)
+
+-- Iteration 26 --
+
+Warning: log() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test log() function : usage variations - different data types as $base argument
+--FILE--
+<?php
+/* Prototype : float log ( float $arg [, float $base ] )
+ * Description: Natural logarithm.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log(3.14, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log() : usage variations ***
+
+-- Iteration 1 --
+float(1.1442227999202)
+
+-- Iteration 2 --
+float(INF)
+
+-- Iteration 3 --
+float(0.12145441273706)
+
+-- Iteration 4 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+float(0.053250469650086)
+
+-- Iteration 6 --
+float(0.48661854224853)
+
+-- Iteration 7 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+float(0.044802684673473)
+
+-- Iteration 9 --
+float(-0.055781611216686)
+
+-- Iteration 10 --
+float(-1.6507645591169)
+
+-- Iteration 11 --
+float(1.1442227999202)
+
+-- Iteration 12 --
+float(1.1442227999202)
+
+-- Iteration 13 --
+float(INF)
+
+-- Iteration 14 --
+float(1.1442227999202)
+
+-- Iteration 15 --
+float(INF)
+
+-- Iteration 16 --
+float(1.1442227999202)
+
+-- Iteration 17 --
+
+Warning: log() expects parameter 2 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: log() expects parameter 2 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log() expects parameter 2 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log() expects parameter 2 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log() expects parameter 2 to be double, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(1.1442227999202)
+
+-- Iteration 25 --
+float(1.1442227999202)
+
+-- Iteration 26 --
+
+Warning: log() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test rand() function : usage variations - different data types as $min argument
+--FILE--
+<?php
+/* Prototype : int mt_rand ([ int $min , int $max ] )
+ * Description: Generate a better random value.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_rand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_rand($input, 100));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_rand() : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: mt_rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_rand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_rand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: mt_rand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
--- /dev/null
+--TEST--
+Test mt_rand() function : usage variations - different data types as $max argument
+--FILE--
+<?php
+/* Prototype : int mt_rand ([ int $min , int $max ] )
+ * Description: Generate a better random value.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_rand) : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_rand(100, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_rand) : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: mt_rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_rand() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_rand() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: mt_rand() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test mt_srand() function : usage variations - different data types as $seed argument
+--FILE--
+<?php
+/* Prototype : void mt_srand ([ int $seed ] )
+ * Description: Seed the better random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_srand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_srand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_srand($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_srand() : usage variations ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+
+Warning: mt_srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_srand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+NULL
+
+-- Iteration 25 --
+NULL
+
+-- Iteration 26 --
+
+Warning: mt_srand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test octdec() - basic function test octdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "*** Testing octdec() : basic functionality ***\n";
+
+$values = array(01234567,
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = octdec($values[$i]);
+ var_dump($res);
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing octdec() : basic functionality ***
+int(14489)
+int(253)
+int(36947879)
+int(4618484)
+int(4104)
+int(5349)
+int(342391)
+int(375)
+int(2147483647)
+int(2147483648)
+int(668)
+int(5349)
+int(102923)
+int(823384)
+int(1)
+int(0)
+int(0)
+===Done===
\ No newline at end of file
Test octdec() - wrong params test octdec()
--FILE--
<?php
+/* Prototype : number octdec ( string $octal_string )
+ * Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing octdec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "\n-- Incorrect number of arguments --\n";
octdec();
octdec('0123567',true);
+
+echo "\n-- Incorrect input --\n";
+octdec(new classA());
+
+
?>
--EXPECTF--
+*** Testing octdec() : error conditions ***
+
+-- Incorrect number of arguments --
Warning: octdec() expects exactly 1 parameter, 0 given in %s on line %d
Warning: octdec() expects exactly 1 parameter, 2 given in %s on line %d
+
+-- Incorrect input --
+
+Catchable fatal error: Object of class classA could not be converted to binary string in %s on line %d
\ No newline at end of file
--- /dev/null
+--TEST--
+Test octdec() function : usage variations - different data types as $octal_string arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : number octdec ( string $octal_string )
+ * Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing octdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of octdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(octdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+---Done---
+--EXPECTF--
+*** Testing octdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(5349)
+
+-- Iteration 4 --
+int(1253)
+
+-- Iteration 5 --
+int(1134037)
+
+-- Iteration 6 --
+int(1134038)
+
+-- Iteration 7 --
+int(69)
+
+-- Iteration 8 --
+int(69)
+
+-- Iteration 9 --
+int(175304192)
+
+-- Iteration 10 --
+int(342391)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+int(%d)
+---Done---
Test pow() - basic function test pow()
--INI--
precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
-$values = array(23,
+$bases = array(23,
-23,
+ 23.1,
+ -23,1,
2.345e1,
-2.345e1,
0x17,
027,
"23",
"23.45",
- "2.345e1",
- null,
- true,
- false);
-
-for ($i = 0; $i < count($values); $i++) {
- $res = pow($values[$i], 4);
- var_dump($res);
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
+
+$exponents = array(0,
+ 1,
+ -1,
+ 2,
+ -2,
+ 3,
+ -3,
+ 2.5,
+ -2.5,
+ 500,
+ -500,
+ 2147483647,
+ -2147483648);
+
+foreach($bases as $base) {
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
}
?>
---EXPECT--
-int(279841)
-int(279841)
-float(302392.75950625)
-float(302392.75950625)
-int(279841)
-int(279841)
-int(279841)
-float(302392.75950625)
-float(302392.75950625)
-int(0)
-int(1)
-int(0)
+===Done===
+--EXPECTF--
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.1
+..... Exponent = -1 Result = 0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = 12326.391
+..... Exponent = -3 Result = 8.1126746668997E-5
+..... Exponent = 2.5 Result = 2564.6608940579
+..... Exponent = -2.5 Result = 0.00038991509650141
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 1
+..... Exponent = -1 Result = 1
+..... Exponent = 2 Result = 1
+..... Exponent = -2 Result = 1
+..... Exponent = 3 Result = 1
+..... Exponent = -3 Result = 1
+..... Exponent = 2.5 Result = 1
+..... Exponent = -2.5 Result = 1
+..... Exponent = 500 Result = 1
+..... Exponent = -500 Result = 1
+..... Exponent = 2147483647 Result = 1
+..... Exponent = -2147483648 Result = 1
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.45
+..... Exponent = -1 Result = -0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = -12895.213625
+..... Exponent = -3 Result = -7.7548153065204E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2.345e1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2147483647
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 2147483647
+..... Exponent = -1 Result = 4.6566128752458E-10
+..... Exponent = 2 Result = 4.6116860141324E+18
+..... Exponent = -2 Result = 2.1684043469905E-19
+..... Exponent = 3 Result = 9.903520300448E+27
+..... Exponent = -3 Result = 1.0097419600935E-28
+..... Exponent = 2.5 Result = 2.1370991100146E+23
+..... Exponent = -2.5 Result = 4.6792401686657E-24
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -2147483648
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -2147483648
+..... Exponent = -1 Result = -4.6566128730774E-10
+..... Exponent = 2 Result = 4.6116860184274E+18
+..... Exponent = -2 Result = 2.168404344971E-19
+..... Exponent = 3 Result = -9.903520314283E+27
+..... Exponent = -3 Result = -1.0097419586829E-28
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test pow() - basic function test pow() - with large exponents
+--INI--
+precision=14
+--FILE--
+<?php
+
+$large_exp = 20000;
+
+echo "\n-- The following all result in INF --\n";
+var_dump(pow(24, $large_exp));
+var_dump(pow(0.24, -$large_exp));
+var_dump(pow(-0.24, -$large_exp));
+
+echo "\n\n-- The following all result in 0 --\n";
+var_dump(pow(0.24, $large_exp));
+var_dump(pow(-0.24, $large_exp));
+var_dump(pow(24, -$large_exp));
+var_dump(pow(-24, -$large_exp));
+
+echo "\n\n-- The following all result in -0 --\n";
+var_dump(pow(-0.24, $large_exp+1));
+
+echo "\n\n-- The following all result in -INF --\n";
+var_dump(pow(-24, $large_exp+1));
+var_dump(pow(-0.24, -$large_exp+1));
+
+?>
+===Done===
+--EXPECTF--
+
+-- The following all result in INF --
+float(INF)
+float(INF)
+float(INF)
+
+
+-- The following all result in 0 --
+float(0)
+float(0)
+float(0)
+float(0)
+
+
+-- The following all result in -0 --
+float(%s)
+
+
+-- The following all result in -INF --
+float(-INF)
+float(-INF)
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test pow() - basic function test pow()
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+$bases = array(23,
+ -23,
+ 23.1,
+ -23,1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
+
+$exponents = array(0,
+ 1,
+ -1,
+ 2,
+ -2,
+ 3,
+ -3,
+ 2.5,
+ -2.5,
+ 500,
+ -500,
+ 2147483647,
+ -2147483648);
+
+foreach($bases as $base) {
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
+}
+?>
+===Done===
+--EXPECTF--
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.1
+..... Exponent = -1 Result = 0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = 12326.391
+..... Exponent = -3 Result = 8.1126746668997E-5
+..... Exponent = 2.5 Result = 2564.6608940579
+..... Exponent = -2.5 Result = 0.00038991509650141
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 1
+..... Exponent = -1 Result = 1
+..... Exponent = 2 Result = 1
+..... Exponent = -2 Result = 1
+..... Exponent = 3 Result = 1
+..... Exponent = -3 Result = 1
+..... Exponent = 2.5 Result = 1
+..... Exponent = -2.5 Result = 1
+..... Exponent = 500 Result = 1
+..... Exponent = -500 Result = 1
+..... Exponent = 2147483647 Result = 1
+..... Exponent = -2147483648 Result = 1
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.45
+..... Exponent = -1 Result = -0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = -12895.213625
+..... Exponent = -3 Result = -7.7548153065204E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2.345e1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 9223372036854775807
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 9223372036854775807
+..... Exponent = -1 Result = 1.0842021724855E-19
+..... Exponent = 2 Result = 8.5070591730235E+37
+..... Exponent = -2 Result = 1.1754943508223E-38
+..... Exponent = 3 Result = 7.8463771692334E+56
+..... Exponent = -3 Result = 1.274473528906E-57
+..... Exponent = 2.5 Result = 2.5835942961798E+47
+..... Exponent = -2.5 Result = 3.8705767444936E-48
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -9223372036854775808
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -9223372036854775808
+..... Exponent = -1 Result = -1.0842021724855E-19
+..... Exponent = 2 Result = 8.5070591730235E+37
+..... Exponent = -2 Result = 1.1754943508223E-38
+..... Exponent = 3 Result = -7.8463771692334E+56
+..... Exponent = -3 Result = -1.274473528906E-57
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test pow() function : usage variations - different data types as $base argument
+--INI--
+precision = 14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ PHP_INT_MAX,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow($input, 3));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+float(1881365963625)
+
+-- Iteration 4 --
+float(-12895213625)
+
+-- Iteration 5 --
+float(9.903520300448E+27)
+
+-- Iteration 6 --
+float(1157.625)
+
+-- Iteration 7 --
+float(-1157.625)
+
+-- Iteration 8 --
+float(1.881676371789%dE+33)
+
+-- Iteration 9 --
+float(1.881676371789%dE-27)
+
+-- Iteration 10 --
+float(0.125)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+float(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done===
--- /dev/null
+--TEST--
+Test pow() function : usage variations - different data types as $base argument
+--INI--
+precision = 14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ PHP_INT_MAX,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow($input, 3));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1881365963625)
+
+-- Iteration 4 --
+int(-12895213625)
+
+-- Iteration 5 --
+float(7.8463771692334E+56)
+
+-- Iteration 6 --
+float(1157.625)
+
+-- Iteration 7 --
+float(-1157.625)
+
+-- Iteration 8 --
+float(1.8816763717892E+33)
+
+-- Iteration 9 --
+float(1.8816763717892E-27)
+
+-- Iteration 10 --
+float(0.125)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+float(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test pow() function : usage variations - different data types as $exp argument
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 2.5,
+ -2.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow(20.3, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+float(1)
+
+-- Iteration 2 --
+float(20.3)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(INF)
+
+-- Iteration 6 --
+float(1856.6929774279)
+
+-- Iteration 7 --
+float(0.00053859200856424)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(1.0000000037168)
+
+-- Iteration 10 --
+float(4.5055521304275)
+
+-- Iteration 11 --
+float(1)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(20.3)
+
+-- Iteration 14 --
+float(1)
+
+-- Iteration 15 --
+float(20.3)
+
+-- Iteration 16 --
+float(1)
+
+-- Iteration 17 --
+float(1)
+
+-- Iteration 18 --
+float(1)
+
+-- Iteration 19 --
+float(1)
+
+-- Iteration 20 --
+float(1)
+
+-- Iteration 21 --
+float(1)
+
+-- Iteration 22 --
+float(1)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(20.3)
+
+-- Iteration 24 --
+float(1)
+
+-- Iteration 25 --
+float(1)
+
+-- Iteration 26 --
+%s
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test rand() function : usage variations - different data types as $min argument
+--FILE--
+<?php
+/* Prototype : int rand ([ int $min , int $max ] )
+ * Description: Generate a random integer.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing rand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(rand($input, 100));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing rand() : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: rand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: rand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: rand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: rand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test rand() function : usage variations - different data types as $max argument
+--FILE--
+<?php
+/* Prototype : int rand ([ int $min , int $max ] )
+ * Description: Generate a random integer.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing rand) : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(rand(100, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing rand) : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: rand() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: rand() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: rand() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: rand() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test round() - basic function test for round()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : basic functionality ***\n";
+
+$values = array(123456789,
+ 123.456789,
+ -4.5679123,
+ 1.23E4,
+ -4.567E3,
+ 0x234567,
+ 067777777,
+ "1.234567",
+ "2.3456789e8",
+ "0x1234CDEF");
+
+$precision = array(2,
+ 8,
+ 0x3,
+ 04,
+ 3.6,
+ "2",
+ "0x03",
+ "04",
+ "3.6",
+ "2.1e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ echo "round: $values[$i]\n";
+ for ($j = 0; $j < count($precision); $j++) {
+ $res = round($values[$i], $precision[$j]);
+ echo "...with precision $precision[$j]-> ";
+ var_dump($res);
+ }
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : basic functionality ***
+round: 123456789
+...with precision 2-> float(123456789)
+...with precision 8-> float(123456789)
+...with precision 3-> float(123456789)
+...with precision 4-> float(123456789)
+...with precision 3.6-> float(123456789)
+...with precision 2-> float(123456789)
+...with precision 0x03-> float(123456789)
+...with precision 04-> float(123456789)
+...with precision 3.6-> float(123456789)
+...with precision 2.1e1-> float(123456789)
+...with precision -> float(123456789)
+...with precision 1-> float(123456789)
+...with precision -> float(123456789)
+round: 123.456789
+...with precision 2-> float(123.46)
+...with precision 8-> float(123.456789)
+...with precision 3-> float(123.457)
+...with precision 4-> float(123.4568)
+...with precision 3.6-> float(123.457)
+...with precision 2-> float(123.46)
+...with precision 0x03-> float(123.457)
+...with precision 04-> float(123.4568)
+...with precision 3.6-> float(123.457)
+...with precision 2.1e1-> float(123.456789)
+...with precision -> float(123)
+...with precision 1-> float(123.5)
+...with precision -> float(123)
+round: -4.5679123
+...with precision 2-> float(-4.57)
+...with precision 8-> float(-4.5679123)
+...with precision 3-> float(-4.568)
+...with precision 4-> float(-4.5679)
+...with precision 3.6-> float(-4.568)
+...with precision 2-> float(-4.57)
+...with precision 0x03-> float(-4.568)
+...with precision 04-> float(-4.5679)
+...with precision 3.6-> float(-4.568)
+...with precision 2.1e1-> float(-4.5679123)
+...with precision -> float(-5)
+...with precision 1-> float(-4.6)
+...with precision -> float(-5)
+round: 12300
+...with precision 2-> float(12300)
+...with precision 8-> float(12300)
+...with precision 3-> float(12300)
+...with precision 4-> float(12300)
+...with precision 3.6-> float(12300)
+...with precision 2-> float(12300)
+...with precision 0x03-> float(12300)
+...with precision 04-> float(12300)
+...with precision 3.6-> float(12300)
+...with precision 2.1e1-> float(12300)
+...with precision -> float(12300)
+...with precision 1-> float(12300)
+...with precision -> float(12300)
+round: -4567
+...with precision 2-> float(-4567)
+...with precision 8-> float(-4567)
+...with precision 3-> float(-4567)
+...with precision 4-> float(-4567)
+...with precision 3.6-> float(-4567)
+...with precision 2-> float(-4567)
+...with precision 0x03-> float(-4567)
+...with precision 04-> float(-4567)
+...with precision 3.6-> float(-4567)
+...with precision 2.1e1-> float(-4567)
+...with precision -> float(-4567)
+...with precision 1-> float(-4567)
+...with precision -> float(-4567)
+round: 2311527
+...with precision 2-> float(2311527)
+...with precision 8-> float(2311527)
+...with precision 3-> float(2311527)
+...with precision 4-> float(2311527)
+...with precision 3.6-> float(2311527)
+...with precision 2-> float(2311527)
+...with precision 0x03-> float(2311527)
+...with precision 04-> float(2311527)
+...with precision 3.6-> float(2311527)
+...with precision 2.1e1-> float(2311527)
+...with precision -> float(2311527)
+...with precision 1-> float(2311527)
+...with precision -> float(2311527)
+round: 14680063
+...with precision 2-> float(14680063)
+...with precision 8-> float(14680063)
+...with precision 3-> float(14680063)
+...with precision 4-> float(14680063)
+...with precision 3.6-> float(14680063)
+...with precision 2-> float(14680063)
+...with precision 0x03-> float(14680063)
+...with precision 04-> float(14680063)
+...with precision 3.6-> float(14680063)
+...with precision 2.1e1-> float(14680063)
+...with precision -> float(14680063)
+...with precision 1-> float(14680063)
+...with precision -> float(14680063)
+round: 1.234567
+...with precision 2-> float(1.23)
+...with precision 8-> float(1.234567)
+...with precision 3-> float(1.235)
+...with precision 4-> float(1.2346)
+...with precision 3.6-> float(1.235)
+...with precision 2-> float(1.23)
+...with precision 0x03-> float(1.235)
+...with precision 04-> float(1.2346)
+...with precision 3.6-> float(1.235)
+...with precision 2.1e1-> float(1.234567)
+...with precision -> float(1)
+...with precision 1-> float(1.2)
+...with precision -> float(1)
+round: 2.3456789e8
+...with precision 2-> float(234567890)
+...with precision 8-> float(234567890)
+...with precision 3-> float(234567890)
+...with precision 4-> float(234567890)
+...with precision 3.6-> float(234567890)
+...with precision 2-> float(234567890)
+...with precision 0x03-> float(234567890)
+...with precision 04-> float(234567890)
+...with precision 3.6-> float(234567890)
+...with precision 2.1e1-> float(234567890)
+...with precision -> float(234567890)
+...with precision 1-> float(234567890)
+...with precision -> float(234567890)
+round: 0x1234CDEF
+...with precision 2-> float(305450479)
+...with precision 8-> float(305450479)
+...with precision 3-> float(305450479)
+...with precision 4-> float(305450479)
+...with precision 3.6-> float(305450479)
+...with precision 2-> float(305450479)
+...with precision 0x03-> float(305450479)
+...with precision 04-> float(305450479)
+...with precision 3.6-> float(305450479)
+...with precision 2.1e1-> float(305450479)
+...with precision -> float(305450479)
+...with precision 1-> float(305450479)
+...with precision -> float(305450479)
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test round() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect number of arguments to round() to test behaviour
+ */
+
+echo "*** Testing round() : error conditions ***\n";
+
+echo "\n-- Wrong nmumber of arguments --\n";
+var_dump(round());
+var_dump(round(500, 10, true));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : error conditions ***
+
+-- Wrong nmumber of arguments --
+
+Warning: round() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+float(500)
+===Done===
--- /dev/null
+--TEST--
+Test round() function : usage variations - different data types as $val argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of round()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(round($input, 14));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1)
+
+-- Iteration 3 --
+float(12345)
+
+-- Iteration 4 --
+float(-2345)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(10.5)
+
+-- Iteration 7 --
+float(-10.5)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(1.23457E-9)
+
+-- Iteration 10 --
+float(0.5)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(1)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+float(0)
+
+-- Iteration 18 --
+float(0)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+float(0)
+
+-- Iteration 21 --
+float(0)
+
+-- Iteration 22 --
+float(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(%f)
+===Done===
--- /dev/null
+--TEST--
+Test round() function : usage variations - different data types as $precision argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e5,
+ 12.3456789000E-5,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of round()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(round(123.4456789, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : usage variations ***
+
+-- Iteration 1 --
+float(123)
+
+-- Iteration 2 --
+float(123.4)
+
+-- Iteration 3 --
+float(123.4456789)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(123.4456789)
+
+-- Iteration 6 --
+float(123.4456789)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(123.4456789)
+
+-- Iteration 9 --
+float(123)
+
+-- Iteration 10 --
+float(123)
+
+-- Iteration 11 --
+float(123)
+
+-- Iteration 12 --
+float(123)
+
+-- Iteration 13 --
+float(123.4)
+
+-- Iteration 14 --
+float(123)
+
+-- Iteration 15 --
+float(123.4)
+
+-- Iteration 16 --
+float(123)
+
+-- Iteration 17 --
+
+Warning: round() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: round() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: round() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: round() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: round() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: round() expects parameter 2 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: round() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(123)
+
+-- Iteration 25 --
+float(123)
+
+-- Iteration 26 --
+
+Warning: round() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file
--- /dev/null
+--TEST--
+Test variations in usage of sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sqrt with a different input values
+echo "*** Testing sqrt() : usage variations ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sqrt($values[$i]);
+ var_dump($res);
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing sqrt() : usage variations ***
+float(4.7958315233127)
+float(NAN)
+float(4.8425200051213)
+float(NAN)
+float(4.7958315233127)
+float(4.7958315233127)
+float(4.7958315233127)
+float(4.8425200051213)
+float(4.8425200051213)
+
+Warning: sqrt() expects parameter 1 to be double, Unicode string given in %s on line %d
+NULL
+float(31.622776601684)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(31.622776601684)
+float(0)
+float(1)
+float(0)
+===Done===
\ No newline at end of file
--TEST--
-Maths test for xapic versions of srand()
+Test srand() - basic function test for srand()
--FILE--
<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing srand() : basic functionality ***\n";
+
// Should return NULL if given anything that it can convert to long
// This doesn't actually test what it does with the input :-\
var_dump(srand());
var_dump(srand(false));
var_dump(srand(NULL));
?>
---EXPECT--
+===Done===
+--EXPECTF--
+*** Testing srand() : basic functionality ***
NULL
NULL
NULL
NULL
NULL
NULL
+===Done===
--TEST--
-Test srand() - wrong params test srand()
+Test srand() function : error conditions - incorrect number of args
--FILE--
<?php
-var_dump(mt_srand(500, true));
-var_dump(mt_srand("fivehundred"));
-var_dump(mt_srand("500ABC"));
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+/*
+ * Pass incorrect number of arguments to srand() to test behaviour
+ */
+
+echo "*** Testing srand() : error conditions ***\n";
+
+var_dump(srand(500, true));
+var_dump(srand("fivehundred"));
+var_dump(srand("500ABC"));
?>
+===Done===
--EXPECTF--
-Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line %d
+*** Testing srand() : error conditions ***
+
+Warning: srand() expects at most 1 parameter, 2 given in %s on line %d
NULL
-Warning: mt_srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
NULL
Notice: A non well formed numeric value encountered in %s on line %d
NULL
+===Done===
--- /dev/null
+--TEST--
+Test srand() function : usage variations - different data types as $seed argument
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing srand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of srand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(srand($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : usage variations ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+
+Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: srand() expects parameter 1 to be long, Unicode string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: srand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+NULL
+
+-- Iteration 25 --
+NULL
+
+-- Iteration 26 --
+
+Warning: srand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
\ No newline at end of file