From: andy wharmby Date: Mon, 12 Jan 2009 17:56:09 +0000 (+0000) Subject: New math tests. Tested on Windows, Linux and Linux 64 bit X-Git-Tag: php-5.4.0alpha1~191^2~4545 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fa10114df9de2b52e99bcea0457815013025747;p=php New math tests. Tested on Windows, Linux and Linux 64 bit --- diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt new file mode 100644 index 0000000000..b28941860f --- /dev/null +++ b/ext/standard/tests/math/log1p_basic.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test log1p() - basic function test log1p() +--INI-- +precision=14 +--FILE-- + +===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=== diff --git a/ext/standard/tests/math/log1p_error.phpt b/ext/standard/tests/math/log1p_error.phpt new file mode 100644 index 0000000000..e0b01a19ac --- /dev/null +++ b/ext/standard/tests/math/log1p_error.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test log1p() - Error conditions +--FILE-- + +===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 diff --git a/ext/standard/tests/math/log1p_variation1.phpt b/ext/standard/tests/math/log1p_variation1.phpt new file mode 100644 index 0000000000..8aabb22ef1 --- /dev/null +++ b/ext/standard/tests/math/log1p_variation1.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test log1p() function : usage variations - different data types as $arg argument +--INI-- +precision=14 +--FILE-- + +===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 diff --git a/ext/standard/tests/math/log_variation1.phpt b/ext/standard/tests/math/log_variation1.phpt new file mode 100644 index 0000000000..8b5e4bb2ba --- /dev/null +++ b/ext/standard/tests/math/log_variation1.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test log() function : usage variations - different data types as $arg argument +--FILE-- + +===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 diff --git a/ext/standard/tests/math/log_variation2.phpt b/ext/standard/tests/math/log_variation2.phpt new file mode 100644 index 0000000000..08f05ffbbf --- /dev/null +++ b/ext/standard/tests/math/log_variation2.phpt @@ -0,0 +1,188 @@ +--TEST-- +Test log() function : usage variations - different data types as $base argument +--FILE-- + +===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 diff --git a/ext/standard/tests/math/mt_rand_variation1.phpt b/ext/standard/tests/math/mt_rand_variation1.phpt new file mode 100644 index 0000000000..7577fd3591 --- /dev/null +++ b/ext/standard/tests/math/mt_rand_variation1.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test rand() function : usage variations - different data types as $min argument +--FILE-- + +===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=== diff --git a/ext/standard/tests/math/mt_rand_variation2.phpt b/ext/standard/tests/math/mt_rand_variation2.phpt new file mode 100644 index 0000000000..b4e84ac872 --- /dev/null +++ b/ext/standard/tests/math/mt_rand_variation2.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test mt_rand() function : usage variations - different data types as $max argument +--FILE-- + +===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 diff --git a/ext/standard/tests/math/mt_srand_variation1.phpt b/ext/standard/tests/math/mt_srand_variation1.phpt new file mode 100644 index 0000000000..0167bab32d --- /dev/null +++ b/ext/standard/tests/math/mt_srand_variation1.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test mt_srand() function : usage variations - different data types as $seed argument +--FILE-- + +===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 diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt new file mode 100644 index 0000000000..a7c6d3b6be --- /dev/null +++ b/ext/standard/tests/math/octdec_basic_64bit.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test octdec() - basic function test octdec() +--SKIPIF-- + +--FILE-- + +===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 diff --git a/ext/standard/tests/math/octdec_error.phpt b/ext/standard/tests/math/octdec_error.phpt index d933ac290d..e230de3ff8 100644 --- a/ext/standard/tests/math/octdec_error.phpt +++ b/ext/standard/tests/math/octdec_error.phpt @@ -2,11 +2,36 @@ Test octdec() - wrong params test octdec() --FILE-- --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 diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt new file mode 100644 index 0000000000..117119600b --- /dev/null +++ b/ext/standard/tests/math/octdec_variation1.phpt @@ -0,0 +1,164 @@ +--TEST-- +Test octdec() function : usage variations - different data types as $octal_string arg +--INI-- +precision=14 +--FILE-- + +---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--- diff --git a/ext/standard/tests/math/pow_basic.phpt b/ext/standard/tests/math/pow_basic.phpt index 4aa42bd289..0fdb158b5a 100644 --- a/ext/standard/tests/math/pow_basic.phpt +++ b/ext/standard/tests/math/pow_basic.phpt @@ -2,36 +2,288 @@ Test pow() - basic function test pow() --INI-- precision=14 +--SKIPIF-- + --FILE-- ---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 diff --git a/ext/standard/tests/math/pow_basic2.phpt b/ext/standard/tests/math/pow_basic2.phpt new file mode 100644 index 0000000000..fc55caccad --- /dev/null +++ b/ext/standard/tests/math/pow_basic2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test pow() - basic function test pow() - with large exponents +--INI-- +precision=14 +--FILE-- + +===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 diff --git a/ext/standard/tests/math/pow_basic_64bit.phpt b/ext/standard/tests/math/pow_basic_64bit.phpt new file mode 100644 index 0000000000..339154142b --- /dev/null +++ b/ext/standard/tests/math/pow_basic_64bit.phpt @@ -0,0 +1,287 @@ +--TEST-- +Test pow() - basic function test pow() +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +===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 diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt new file mode 100644 index 0000000000..df511906b0 --- /dev/null +++ b/ext/standard/tests/math/pow_variation1.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test pow() function : usage variations - different data types as $base argument +--INI-- +precision = 14 +--SKIPIF-- + +--FILE-- + +===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=== diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt new file mode 100644 index 0000000000..24b482680b --- /dev/null +++ b/ext/standard/tests/math/pow_variation1_64bit.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test pow() function : usage variations - different data types as $base argument +--INI-- +precision = 14 +--SKIPIF-- + +--FILE-- + +===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 diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt new file mode 100644 index 0000000000..b1800bb15f --- /dev/null +++ b/ext/standard/tests/math/pow_variation2.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test pow() function : usage variations - different data types as $exp argument +--INI-- +precision = 14 +--FILE-- + +===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 diff --git a/ext/standard/tests/math/rand_variation1.phpt b/ext/standard/tests/math/rand_variation1.phpt new file mode 100644 index 0000000000..d70c8f68cf --- /dev/null +++ b/ext/standard/tests/math/rand_variation1.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test rand() function : usage variations - different data types as $min argument +--FILE-- + +===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 diff --git a/ext/standard/tests/math/rand_variation2.phpt b/ext/standard/tests/math/rand_variation2.phpt new file mode 100644 index 0000000000..6a271d6864 --- /dev/null +++ b/ext/standard/tests/math/rand_variation2.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test rand() function : usage variations - different data types as $max argument +--FILE-- + +===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 diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt new file mode 100644 index 0000000000..dd4725f244 --- /dev/null +++ b/ext/standard/tests/math/round_basic.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test round() - basic function test for round() +--INI-- +precision=14 +--FILE-- + "; + 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 diff --git a/ext/standard/tests/math/round_error.phpt b/ext/standard/tests/math/round_error.phpt new file mode 100644 index 0000000000..28a6d5cf79 --- /dev/null +++ b/ext/standard/tests/math/round_error.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test round() function : error conditions - incorrect number of args +--FILE-- + +===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=== diff --git a/ext/standard/tests/math/round_variation1.phpt b/ext/standard/tests/math/round_variation1.phpt new file mode 100644 index 0000000000..c89dd6818a --- /dev/null +++ b/ext/standard/tests/math/round_variation1.phpt @@ -0,0 +1,173 @@ +--TEST-- +Test round() function : usage variations - different data types as $val argument +--INI-- +precision=14 +--FILE-- + +===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=== diff --git a/ext/standard/tests/math/round_variation2.phpt b/ext/standard/tests/math/round_variation2.phpt new file mode 100644 index 0000000000..2d4df51396 --- /dev/null +++ b/ext/standard/tests/math/round_variation2.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test round() function : usage variations - different data types as $precision argument +--INI-- +precision=14 +--FILE-- + +===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 diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt new file mode 100644 index 0000000000..aaa8e4ca50 --- /dev/null +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test variations in usage of sqrt() +--INI-- +precision = 14 +--FILE-- + +===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 diff --git a/ext/standard/tests/math/srand_basic.phpt b/ext/standard/tests/math/srand_basic.phpt index 6f4228530b..b56ad10ac0 100644 --- a/ext/standard/tests/math/srand_basic.phpt +++ b/ext/standard/tests/math/srand_basic.phpt @@ -1,7 +1,14 @@ --TEST-- -Maths test for xapic versions of srand() +Test srand() - basic function test for srand() --FILE-- ---EXPECT-- +===Done=== +--EXPECTF-- +*** Testing srand() : basic functionality *** NULL NULL NULL @@ -22,3 +31,4 @@ NULL NULL NULL NULL +===Done=== diff --git a/ext/standard/tests/math/srand_error.phpt b/ext/standard/tests/math/srand_error.phpt index 1757a75baa..5431990b5a 100644 --- a/ext/standard/tests/math/srand_error.phpt +++ b/ext/standard/tests/math/srand_error.phpt @@ -1,17 +1,32 @@ --TEST-- -Test srand() - wrong params test srand() +Test srand() function : error conditions - incorrect number of args --FILE-- +===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=== diff --git a/ext/standard/tests/math/srand_variation1.phpt b/ext/standard/tests/math/srand_variation1.phpt new file mode 100644 index 0000000000..25eafd98a6 --- /dev/null +++ b/ext/standard/tests/math/srand_variation1.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test srand() function : usage variations - different data types as $seed argument +--FILE-- + +===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