zoe Wed Feb 6 08:44:24 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/math sqrt_error.phpt rand_error.phpt rand_basic.phpt log_error.phpt is_infinite_basic.phpt srand_basic.phpt fmod_error.phpt exp_error.phpt hypot_error.phpt deg2rad_basic.phpt hexdec_error.phpt decoct_error.phpt dechex_error.phpt is_nan_error.phpt mt_rand_error.phpt log10_error.phpt rad2deg_error.phpt hexdec_basic.phpt sqrt_basic.phpt rad2deg_variation.phpt octdec_error.phpt pow_basic.phpt octdec_basic.phpt rad2deg_basic.phpt log_basic.phpt getrandmax_error.phpt decoct_basic.phpt getrandmax_basic.phpt is_nan_basic.phpt lcg_value_basic.phpt mt_srand_basic.phpt log10_variation.phpt mt_getrandmax_basic.phpt mt_getrandmax_error.phpt mt_srand_error.phpt pow_error.phpt fmod_basic.phpt srand_error.phpt mt_rand_basic.phpt is_finite_basic.phpt number_format_basic.phpt is_finite_error.phpt dechex_basic.phpt pi_basic.phpt log10_basic.phpt deg2rad_error.phpt is_infinite_error.phpt deg2rad_variation.phpt Log: Tests for assorted Maths functions
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/sqrt_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/sqrt_error.phpt +++ php-src/ext/standard/tests/math/sqrt_error.phpt --TEST-- Test wrong number of arguments for sqrt() --INI-- precision = 14 --FILE-- <?php /* * proto float sqrt(float number) * Function is implemented in ext/standard/math.c */
$arg_0 = 1.0; $extra_arg = 1; echo "\nToo many arguments\n"; var_dump(sqrt($arg_0, $extra_arg)); echo "\nToo few arguments\n"; var_dump(sqrt()); ?> --EXPECTF-- Too many arguments Warning: sqrt() expects exactly 1 parameter, 2 given in %s on line %d NULL Too few arguments Warning: sqrt() expects exactly 1 parameter, 0 given in %s on line %d NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/rand_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/rand_error.phpt +++ php-src/ext/standard/tests/math/rand_error.phpt --TEST-- Test rand() - wrong params test rand() --FILE-- <?php rand(25); rand(10,100,false); rand("one", 100); rand(1, "hundered"); ?> --EXPECTF-- Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d Warning: rand() expects exactly 2 parameters, 3 given in %s on line %d Warning: rand() expects parameter 1 to be long, string given in %s on line %d Warning: rand() expects parameter 2 to be long, string given in %s on line %d --UEXPECTF-- Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d Warning: rand() expects exactly 2 parameters, 3 given in %s on line %d Warning: rand() expects parameter 1 to be long, Unicode string given in %s on line %d Warning: rand() expects parameter 2 to be long, Unicode string given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/rand_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/rand_basic.phpt +++ php-src/ext/standard/tests/math/rand_basic.phpt --TEST-- Test rand() - basic function test rand() --FILE-- <?php $default_max = getrandmax(); echo "\nrand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n"; for ($i = 0; $i < 100; $i++) { $res = rand(); // By default RAND_MAX is 32768 although no constant is defined for it for user space apps if (!is_int($res) || $res < 0 || $res > $default_max) { break; } } if ($i != 100) { echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n"; } else { echo "PASSED: range min = 0 max = ", $default_max, "\n"; } echo "\nrand() tests with defined min and max value\n"; $min = array(10, 100, 10.5, 10.5e3, 0x10, 0400); $max = array(100, 1000, 19.5, 10.5e5, 0x10000, 0700); for ($x = 0; $x < count($min); $x++) { for ($i = 0; $i < 100; $i++) { $res = rand($min[$x], $max[$x]); if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) { echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; break; } } if ($i == 100) { echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; } } echo "\nNon-numeric cases\n"; $min = array(true, false, null, "10", "0x10", "10.5"); // Eexepcted numerical equivalent of above non-numerics $minval = array(1, 0, 0, 10, 0, 10); for ($x = 0; $x < count($min); $x++) { for ($i = 0; $i < 100; $i++) { $res = rand($min[$x], 100); if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) { echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; break; } } if ($i == 100) { echo "PASSED range min = ", intval($min[$x]), " max = 100\n"; } } ?> --EXPECTF-- rand() tests with default min and max value (i.e 0 thru %i) PASSED: range min = 0 max = %i rand() tests with defined min and max value PASSED: range min = 10 max = 100 PASSED: range min = 100 max = 1000 PASSED: range min = 10 max = 19 PASSED: range min = 10500 max = 1050000 PASSED: range min = 16 max = 65536 PASSED: range min = 256 max = 448 Non-numeric cases PASSED range min = 1 max = 100 PASSED range min = 0 max = 100 PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/log_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/log_error.phpt +++ php-src/ext/standard/tests/math/log_error.phpt --TEST-- Test log() - wrong params test log() --INI-- precision=14 --FILE-- <?php log(); log(36,4,true); log(36, -4); ?> --EXPECTF-- Warning: log() expects at least 1 parameter, 0 given in %s on line %d Warning: log() expects at most 2 parameters, 3 given in %s on line %d Warning: log(): base must be greater than 0 in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/is_infinite_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/is_infinite_basic.phpt +++ php-src/ext/standard/tests/math/is_infinite_basic.phpt --TEST-- Test is_infinite() - basic function test is_infinite() --FILE-- <?php $values = array(234, -234, 23.45e1, -23.45e1, 0xEA, 0352, "234", "234.5", "23.45e1", null, true, false, pow(0, -2), acos(1.01)); ; for ($i = 0; $i < count($values); $i++) { $res = is_infinite($values[$i]); var_dump($res); } ?> --EXPECTF-- bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(true) bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/srand_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/srand_basic.phpt +++ php-src/ext/standard/tests/math/srand_basic.phpt --TEST-- Maths test for xapic versions of srand() --FILE-- <?php // 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(500)); var_dump(srand(500.1)); var_dump(srand("500")); var_dump(srand("500E3")); var_dump(srand(true)); var_dump(srand(false)); var_dump(srand(NULL)); ?> --EXPECTF-- NULL NULL NULL NULL NULL NULL NULL NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/fmod_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/fmod_error.phpt +++ php-src/ext/standard/tests/math/fmod_error.phpt --TEST-- Test fmod() - wrong params test fmod() --INI-- precision=14 --FILE-- <?php fmod(); fmod(23); fmod(23,2,true); ?> --EXPECTF-- Warning: fmod() expects exactly 2 parameters, 0 given in %s on line 2 Warning: fmod() expects exactly 2 parameters, 1 given in %s on line 3 Warning: fmod() expects exactly 2 parameters, 3 given in %s on line 4 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/exp_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/exp_error.phpt +++ php-src/ext/standard/tests/math/exp_error.phpt --TEST-- Test exp() - wrong params for exp() --INI-- precision=14 --FILE-- <?php exp(); exp(23,true); ?> --EXPECTF-- Warning: exp() expects exactly 1 parameter, 0 given in %s on line %d Warning: exp() expects exactly 1 parameter, 2 given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/hypot_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/hypot_error.phpt +++ php-src/ext/standard/tests/math/hypot_error.phpt --TEST-- Test hypot() - wrong params test hypot() --INI-- precision=14 --FILE-- <?php hypot(); hypot(36); hypot(36,25,0); ?> --EXPECTF-- Warning: hypot() expects exactly 2 parameters, 0 given in %s on line %d Warning: hypot() expects exactly 2 parameters, 1 given in %s on line %d Warning: hypot() expects exactly 2 parameters, 3 given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/deg2rad_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/deg2rad_basic.phpt +++ php-src/ext/standard/tests/math/deg2rad_basic.phpt --TEST-- Test return type and value for expected input deg2rad() --INI-- precision = 14 --FILE-- <?php /* * proto float deg2rad(float number) * Function is implemented in ext/standard/math.c */ $file_path = dirname(__FILE__); require($file_path."/allowed_rounding_error.inc"); $arg_0 = 0.0; $arg_1 = 90.0; $arg_2 = 180.0; $arg_3 = 360.0; echo "deg2rad $arg_0 = "; $r0 = deg2rad($arg_0); var_dump($r0); if (allowed_rounding_error($r0 ,0 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "deg2rad $arg_1 = "; $r1 = deg2rad($arg_1); var_dump($r1); if (allowed_rounding_error($r1 ,1.5707963267949 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "deg2rad $arg_2 = "; $r2 = deg2rad($arg_2); var_dump($r2); if (allowed_rounding_error($r2 ,3.1415926535898 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "deg2rad $arg_3 = "; $r3 = deg2rad($arg_3); var_dump($r3); if (allowed_rounding_error($r3 ,6.2831853071796 )) { echo "Pass\n"; } else { echo "Fail\n"; } ?> --EXPECTF-- deg2rad 0 = float(%f) Pass deg2rad 90 = float(%f) Pass deg2rad 180 = float(%f) Pass deg2rad 360 = float(%f) Pass http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/hexdec_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/hexdec_error.phpt +++ php-src/ext/standard/tests/math/hexdec_error.phpt --TEST-- Test hexdec() - wrong params test hexdec() --FILE-- <?php hexdec(); hexdec('0x123abc',true); ?> --EXPECTF-- Warning: hexdec() expects exactly 1 parameter, 0 given in %s on line %d Warning: hexdec() expects exactly 1 parameter, 2 given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/decoct_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/decoct_error.phpt +++ php-src/ext/standard/tests/math/decoct_error.phpt --TEST-- Test decoct() - wrong params decoct() --FILE-- <?php decoct(); decoct(23,2,true); ?> --EXPECTF-- Warning: decoct() expects exactly 1 parameter, 0 given in %s on line %d Warning: decoct() expects exactly 1 parameter, 3 given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/dechex_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/dechex_error.phpt +++ php-src/ext/standard/tests/math/dechex_error.phpt --TEST-- Test dechex() - wrong params dechex() --FILE-- <?php dechex(); dechex(23,2,true); ?> --EXPECTF-- Warning: dechex() expects exactly 1 parameter, 0 given in %s on line %d Warning: dechex() expects exactly 1 parameter, 3 given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/is_nan_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/is_nan_error.phpt +++ php-src/ext/standard/tests/math/is_nan_error.phpt --TEST-- Test is_nan() - wrong params test is_nan() --FILE-- <?php is_nan(); is_nan(23,2,true); ?> --EXPECTF-- Warning: is_nan() expects exactly 1 parameter, 0 given in %s on line 2 Warning: is_nan() expects exactly 1 parameter, 3 given in %s on line 3 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/mt_rand_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/mt_rand_error.phpt +++ php-src/ext/standard/tests/math/mt_rand_error.phpt --TEST-- Test mt_rand() - wrong params test mt_rand() --FILE-- <?php mt_rand(25); mt_rand(10,100,false); mt_rand("one", 100); mt_rand(1, "hundered"); ?> --EXPECTF-- Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d Warning: mt_rand() expects exactly 2 parameters, 3 given in %s on line %d Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d --UEXPECTF-- Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d Warning: mt_rand() expects exactly 2 parameters, 3 given in %s on line %d Warning: mt_rand() expects parameter 1 to be long, Unicode string given in %s on line %d Warning: mt_rand() expects parameter 2 to be long, Unicode string given in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/log10_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/log10_error.phpt +++ php-src/ext/standard/tests/math/log10_error.phpt --TEST-- Test wrong number of arguments for log10() --INI-- precision = 14 --FILE-- <?php /* * proto float log10(float number) * Function is implemented in ext/standard/math.c */ $arg_0 = 1.0; $extra_arg = 1; echo "\nToo many arguments\n"; var_dump(log10($arg_0, $extra_arg)); echo "\nToo few arguments\n"; var_dump(log10()); ?> --EXPECTF-- Too many arguments Warning: log10() expects exactly 1 parameter, 2 given in %s on line 11 NULL Too few arguments Warning: log10() expects exactly 1 parameter, 0 given in %s on line 14 NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/rad2deg_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/rad2deg_error.phpt +++ php-src/ext/standard/tests/math/rad2deg_error.phpt --TEST-- Test wrong number of arguments for rad2deg() --INI-- precision = 14 --FILE-- <?php /* * proto float rad2deg(float number) * Function is implemented in ext/standard/math.c */ $arg_0 = 1.0; $extra_arg = 1; echo "\nToo many arguments\n"; var_dump(rad2deg($arg_0, $extra_arg)); echo "\nToo few arguments\n"; var_dump(rad2deg()); ?> --EXPECTF-- Too many arguments Warning: rad2deg() expects exactly 1 parameter, 2 given in %s on line 11 NULL Too few arguments Warning: rad2deg() expects exactly 1 parameter, 0 given in %s on line 14 NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/hexdec_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/hexdec_basic.phpt +++ php-src/ext/standard/tests/math/hexdec_basic.phpt --TEST-- Test hexdec() - basic function test hexdec() --FILE-- <?php $values = array(0x123abc, 0x789DEF, 0x7FFFFFFF, 0x80000000, '0x123abc', '0x789DEF', '0x7FFFFFFF', '0x80000000', '0x123XYZABC', 311015, '311015', 31101.3, 31.1013e5, 011237, '011237', true, false, null); for ($i = 0; $i < count($values); $i++) { $res = hexdec($values[$i]); var_dump($res); } ?> --EXPECTF-- int(18433668) int(126895953) float(142929835591) float(142929835592) int(1194684) int(7904751) int(2147483647) float(2147483648) int(1194684) int(3215381) int(3215381) int(3215379) int(51446064) int(18279) int(70199) int(1) int(0) int(0) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/sqrt_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/sqrt_basic.phpt +++ php-src/ext/standard/tests/math/sqrt_basic.phpt --TEST-- Test return type and value for expected input sqrt() --INI-- precision = 14 --FILE-- <?php /* * proto float sqrt(float number) * Function is implemented in ext/standard/math.c */ $arg_0 = 9.0; var_dump(sqrt($arg_0)); ?> --EXPECT-- float(3) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/rad2deg_variation.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/rad2deg_variation.phpt +++ php-src/ext/standard/tests/math/rad2deg_variation.phpt --TEST-- Test variations in usage of rad2deg() --INI-- precision = 10 --FILE-- <?php /* * proto float rad2deg(float number) * Function is implemented in ext/standard/math.c */ //Test rad2deg with a different input values $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 = rad2deg($values[$i]); var_dump($res); } ?> --EXPECTF-- float(1317.802929) float(-1317.802929) float(1343.58603) float(-1343.58603) float(1317.802929) float(1317.802929) float(1317.802929) float(1343.58603) float(1343.58603) Warning: rad2deg() expects parameter 1 to be double, string given in %s on line 27 NULL float(57295.77951) Notice: A non well formed numeric value encountered in %s on line 27 float(57295.77951) float(0) float(57.29577951) float(0) --UEXPECTF-- float(1317.802929) float(-1317.802929) float(1343.58603) float(-1343.58603) float(1317.802929) float(1317.802929) float(1317.802929) float(1343.58603) float(1343.58603) Warning: rad2deg() expects parameter 1 to be double, Unicode string given in %s on line 27 NULL float(57295.77951) Notice: A non well formed numeric value encountered in %s on line 27 float(57295.77951) float(0) float(57.29577951) float(0) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/octdec_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/octdec_error.phpt +++ php-src/ext/standard/tests/math/octdec_error.phpt --TEST-- Test octdec() - wrong params test octdec() --FILE-- <?php octdec(); octdec('0123567',true); ?> --EXPECTF-- 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 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/pow_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/pow_basic.phpt +++ php-src/ext/standard/tests/math/pow_basic.phpt --TEST-- Test pow() - basic function test pow() --INI-- precision=14 --FILE-- <?php $values = array(23, -23, 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); } ?> --EXPECTF-- 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) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/octdec_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/octdec_basic.phpt +++ php-src/ext/standard/tests/math/octdec_basic.phpt --TEST-- Test octdec() - basic function test octdec() --FILE-- <?php $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); } ?> --EXPECTF-- int(14489) int(253) int(36947879) int(4618484) int(4104) int(5349) int(342391) int(375) int(2147483647) float(2147483648) int(668) int(5349) int(102923) int(823384) int(1) int(0) int(0) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/rad2deg_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/rad2deg_basic.phpt +++ php-src/ext/standard/tests/math/rad2deg_basic.phpt --TEST-- Test return type and value for expected input rad2deg() --INI-- precision = 14 --FILE-- <?php /* * proto float rad2deg(float number) * Function is implemented in ext/standard/math.c */ $file_path = dirname(__FILE__); require($file_path."/allowed_rounding_error.inc"); $arg_0 = 0.0; $arg_1 = 1.570796327; $arg_2 = 3.141592654; $arg_3 = 6.283185307; echo "rad2deg $arg_0= "; $r0 = rad2deg($arg_0); var_dump($r0); if (allowed_rounding_error($r0 ,0 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "rad2deg $arg_1 = "; $r1 = rad2deg($arg_1); var_dump($r1); if (allowed_rounding_error($r1 ,90.000000011752)) { echo "Pass\n"; } else { echo "Fail\n"; } echo "rad2deg $arg_2 = "; $r2 = rad2deg($arg_2); var_dump($r2); if (allowed_rounding_error($r2 ,180.0000000235 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "rad2deg $arg_3 = "; $r3 = rad2deg($arg_3); var_dump($r3); if (allowed_rounding_error($r3 ,359.99999998971 )) { echo "Pass\n"; } else { echo "Fail\n"; } ?> --EXPECTF-- rad2deg 0= float(%f) Pass rad2deg 1.570796327 = float(%f) Pass rad2deg 3.141592654 = float(%f) Pass rad2deg 6.283185307 = float(%f) Pass http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/log_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/log_basic.phpt +++ php-src/ext/standard/tests/math/log_basic.phpt --TEST-- Test log() - basic function test log() --INI-- precision=14 --FILE-- <?php $values = array(23, -23, 2.345e1, -2.345e1, 0x17, 027, "23", "23.45", "2.345e1", null, true, false); echo "\n LOG tests...no base\n"; for ($i = 0; $i < count($values); $i++) { $res = log($values[$i]); var_dump($res); } echo "\n LOG tests...base\n"; for ($i = 0; $i < count($values); $i++) { $res = log($values[$i], 4); var_dump($res); } ?> --EXPECTF-- LOG tests...no base float(3.1354942159291) float(NAN) float(3.1548704948923) float(NAN) float(3.1354942159291) float(3.1354942159291) float(3.1354942159291) float(3.1548704948923) float(3.1548704948923) float(-INF) float(0) float(-INF) LOG tests...base float(2.2617809780285) float(NAN) float(2.275758008814) float(NAN) float(2.2617809780285) float(2.2617809780285) float(2.2617809780285) float(2.275758008814) float(2.275758008814) float(-INF) float(0) float(-INF) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/getrandmax_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/getrandmax_error.phpt +++ php-src/ext/standard/tests/math/getrandmax_error.phpt --TEST-- Test getrandmax() - wrong params test getrandmax() --FILE-- <?php var_dump($biggest_int = getrandmax(true)); ?> --EXPECTF-- Warning: Wrong parameter count for getrandmax() in %s on line 2 NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/decoct_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/decoct_basic.phpt +++ php-src/ext/standard/tests/math/decoct_basic.phpt --TEST-- Test decoct() - basic function test decoct() --FILE-- <?php $values = array(10, 3950.5, 3.9505e3, 039, 0x5F, "10", "3950.5", "3.9505e3", "039", "0x5F", true, false, null, ); for ($i = 0; $i < count($values); $i++) { $res = decoct($values[$i]); var_dump($res); } ?> --EXPECTF-- string(2) "12" string(4) "7556" string(4) "7556" string(1) "3" string(3) "137" string(2) "12" string(4) "7556" string(1) "3" string(2) "47" string(1) "0" string(1) "1" string(1) "0" string(1) "0" --UEXPECTF-- unicode(2) "12" unicode(4) "7556" unicode(4) "7556" unicode(1) "3" unicode(3) "137" unicode(2) "12" unicode(4) "7556" unicode(1) "3" unicode(2) "47" unicode(1) "0" unicode(1) "1" unicode(1) "0" unicode(1) "0" http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/getrandmax_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/getrandmax_basic.phpt +++ php-src/ext/standard/tests/math/getrandmax_basic.phpt --TEST-- Test getrandmax() - basic function test getrandmax() --FILE-- <?php $biggest_int = getrandmax(); var_dump($biggest_int); ?> --EXPECTF-- int(%d) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/is_nan_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/is_nan_basic.phpt +++ php-src/ext/standard/tests/math/is_nan_basic.phpt --TEST-- Test is_nan() - basic function test is_nan() --FILE-- <?php $values = array(234, -234, 23.45e1, -23.45e1, 0xEA, 0352, "234", "234.5", "23.45e1", null, true, false, pow(0, -2), acos(1.01)); for ($i = 0; $i < count($values); $i++) { $res = is_nan($values[$i]); var_dump($res); } ?> --EXPECTF-- bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/lcg_value_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/lcg_value_basic.phpt +++ php-src/ext/standard/tests/math/lcg_value_basic.phpt --TEST-- Maths test for xapic versions of lcg_value() --FILE-- <?php echo "MATHS test script started\n"; echo "\n lcg_value tests...\n"; for ($i = 0; $i < 100; $i++) { $res = lcg_value(); if (!is_float($res) || $res < 0 || $res > 1) { break; } } if ($i != 100) { echo "FAILED\n"; } else { echo "PASSED\n"; } echo "\n lcg_value error cases..spurious args get ignored\n"; $res = lcg_value(23); if (!is_float($res) || $res < 0 || $res > 1) { echo "FAILED\n"; } else { echo "PASSED\n"; } $res = lcg_value(10,false); if (!is_float($res) || $res < 0 || $res > 1) { echo "FAILED\n"; } else { echo "PASSED\n"; } echo "MATHS test script completed\n"; ?> --EXPECT-- MATHS test script started lcg_value tests... PASSED lcg_value error cases..spurious args get ignored PASSED PASSED MATHS test script completed http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/mt_srand_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/mt_srand_basic.phpt +++ php-src/ext/standard/tests/math/mt_srand_basic.phpt --TEST-- Test mt_srand() - basic function (return values) mt_srand() --FILE-- <?php // 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(mt_srand()); var_dump(mt_srand(500)); var_dump(mt_srand(500.1)); var_dump(mt_srand("500")); var_dump(mt_srand("500E3")); var_dump(mt_srand(true)); var_dump(mt_srand(false)); var_dump(mt_srand(NULL)); ?> --EXPECTF-- NULL NULL NULL NULL NULL NULL NULL NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/log10_variation.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/log10_variation.phpt +++ php-src/ext/standard/tests/math/log10_variation.phpt --TEST-- Test variations in usage of log10() --INI-- precision = 10 --FILE-- <?php /* * proto float log10(float number) * Function is implemented in ext/standard/math.c */ //Test log10 with a different input values $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 = log10($values[$i]); var_dump($res); } ?> --EXPECTF-- float(1.361727836) float(NAN) float(1.370142847) float(NAN) float(1.361727836) float(1.361727836) float(1.361727836) float(1.370142847) float(1.370142847) Warning: log10() expects parameter 1 to be double, string given in %s on line 27 NULL float(3) Notice: A non well formed numeric value encountered in %s on line 27 float(3) float(-INF) float(0) float(-INF) --UEXPECTF-- float(1.361727836) float(NAN) float(1.370142847) float(NAN) float(1.361727836) float(1.361727836) float(1.361727836) float(1.370142847) float(1.370142847) Warning: log10() expects parameter 1 to be double, Unicode string given in %s on line 27 NULL float(3) Notice: A non well formed numeric value encountered in %s on line 27 float(3) float(-INF) float(0) float(-INF) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/mt_getrandmax_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/mt_getrandmax_basic.phpt +++ php-src/ext/standard/tests/math/mt_getrandmax_basic.phpt --TEST-- Test mt_getrandmax() - basic function test mt_getrandmax() --FILE-- <?php var_dump(mt_getrandmax()); ?> --EXPECTF-- int(%d) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/mt_getrandmax_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/mt_getrandmax_error.phpt +++ php-src/ext/standard/tests/math/mt_getrandmax_error.phpt --TEST-- Test mt_getrandmax() - wrong paramas mt_getrandmax() --FILE-- <?php var_dump(mt_getrandmax(true)); ?> --EXPECTF-- Warning: Wrong parameter count for mt_getrandmax() in %s on line 2 NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/mt_srand_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/mt_srand_error.phpt +++ php-src/ext/standard/tests/math/mt_srand_error.phpt --TEST-- Test mt_srand() - wrong params test mt_srand() --FILE-- <?php var_dump(mt_srand(500, true)); var_dump(mt_srand("fivehundred")); var_dump(mt_srand("500ABC")); ?> --EXPECTF-- Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line %d NULL Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d NULL Notice: A non well formed numeric value encountered in %s on line %d NULL --UEXPECTF-- Warning: mt_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 NULL Notice: A non well formed numeric value encountered in %s on line %d NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/pow_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/pow_error.phpt +++ php-src/ext/standard/tests/math/pow_error.phpt --TEST-- Test pow() - wrong params test pow() --INI-- precision=14 --FILE-- <?php pow(); pow(36); pow(36,4,true); ?> --EXPECTF-- Warning: pow() expects exactly 2 parameters, 0 given in %s line 2 Warning: pow() expects exactly 2 parameters, 1 given in %s line 3 Warning: pow() expects exactly 2 parameters, 3 given in %s line 4 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/fmod_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/fmod_basic.phpt +++ php-src/ext/standard/tests/math/fmod_basic.phpt --TEST-- Test fmod() - basic function test fmod() --INI-- precision=14 --FILE-- <?php $values1 = array(234, -234, 23.45e1, -23.45e1, 0xEA, 0352, "234", "234.5", "23.45e1", null, true, false); $values2 = array(2, -2, 2.3e1, -2.3e1, 0x2, 02, "2", "2.3", "2.3e1", null, true, false); for ($i = 0; $i < count($values1); $i++) { echo "\niteration ", $i, "\n"; for ($j = 0; $j < count($values2); $j++) { $res = fmod($values1[$i], $values2[$j]); var_dump($res); } } ?> --EXPECTF-- iteration 0 float(0) float(0) float(4) float(4) float(0) float(0) float(0) float(1.7) float(4) float(NAN) float(0) float(NAN) iteration 1 float(-0) float(-0) float(-4) float(-4) float(-0) float(-0) float(-0) float(-1.7) float(-4) float(NAN) float(-0) float(NAN) iteration 2 float(0.5) float(0.5) float(4.5) float(4.5) float(0.5) float(0.5) float(0.5) float(2.2) float(4.5) float(NAN) float(0.5) float(NAN) iteration 3 float(-0.5) float(-0.5) float(-4.5) float(-4.5) float(-0.5) float(-0.5) float(-0.5) float(-2.2) float(-4.5) float(NAN) float(-0.5) float(NAN) iteration 4 float(0) float(0) float(4) float(4) float(0) float(0) float(0) float(1.7) float(4) float(NAN) float(0) float(NAN) iteration 5 float(0) float(0) float(4) float(4) float(0) float(0) float(0) float(1.7) float(4) float(NAN) float(0) float(NAN) iteration 6 float(0) float(0) float(4) float(4) float(0) float(0) float(0) float(1.7) float(4) float(NAN) float(0) float(NAN) iteration 7 float(0.5) float(0.5) float(4.5) float(4.5) float(0.5) float(0.5) float(0.5) float(2.2) float(4.5) float(NAN) float(0.5) float(NAN) iteration 8 float(0.5) float(0.5) float(4.5) float(4.5) float(0.5) float(0.5) float(0.5) float(2.2) float(4.5) float(NAN) float(0.5) float(NAN) iteration 9 float(0) float(0) float(0) float(0) float(0) float(0) float(0) float(0) float(0) float(NAN) float(0) float(NAN) iteration 10 float(1) float(1) float(1) float(1) float(1) float(1) float(1) float(1) float(1) float(NAN) float(0) float(NAN) iteration 11 float(0) float(0) float(0) float(0) float(0) float(0) float(0) float(0) float(0) float(NAN) float(0) float(NAN) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/srand_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/srand_error.phpt +++ php-src/ext/standard/tests/math/srand_error.phpt --TEST-- Test srand() - wrong params test srand() --FILE-- <?php var_dump(mt_srand(500, true)); var_dump(mt_srand("fivehundred")); var_dump(mt_srand("500ABC")); ?> --EXPECTF-- Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line %d NULL Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d NULL Notice: A non well formed numeric value encountered in %s on line %d NULL --UEXPECTF-- Warning: mt_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 NULL Notice: A non well formed numeric value encountered in %s on line %d NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/mt_rand_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/mt_rand_basic.phpt +++ php-src/ext/standard/tests/math/mt_rand_basic.phpt --TEST-- Test mt_rand() - basic function test mt_rand() --FILE-- <?php $default_max = mt_getrandmax(); echo "\nmt_rand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n"; for ($i = 0; $i < 100; $i++) { $res = mt_rand(); // By default RAND_MAX is 32768 although no constant is defined for it for user space apps if (!is_int($res) || $res < 0 || $res > $default_max) { break; } } if ($i != 100) { echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n"; } else { echo "PASSED: range min = 0 max = ", $default_max, "\n"; } echo "\nmt_rand() tests with defined min and max value\n"; $min = array(10, 100, 10.5, 10.5e3, 0x10, 0400); $max = array(100, 1000, 19.5, 10.5e5, 0x10000, 0700); for ($x = 0; $x < count($min); $x++) { for ($i = 0; $i < 100; $i++) { $res = mt_rand($min[$x], $max[$x]); if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) { echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; break; } } if ($i == 100) { echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; } } echo "\nNon-numeric cases\n"; $min = array(true, false, null, "10", "0x10", "10.5"); // Eexepcted numerical equivalent of above non-numerics $minval = array(1, 0, 0, 10, 0, 10); for ($x = 0; $x < count($min); $x++) { for ($i = 0; $i < 100; $i++) { $res = mt_rand($min[$x], 100); if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) { echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n"; break; } } if ($i == 100) { echo "PASSED range min = ", intval($min[$x]), " max = 100\n"; } } ?> --EXPECTF-- mt_rand() tests with default min and max value (i.e 0 thru 2147483647) PASSED: range min = 0 max = 2147483647 mt_rand() tests with defined min and max value PASSED: range min = 10 max = 100 PASSED: range min = 100 max = 1000 PASSED: range min = 10 max = 19 PASSED: range min = 10500 max = 1050000 PASSED: range min = 16 max = 65536 PASSED: range min = 256 max = 448 Non-numeric cases PASSED range min = 1 max = 100 PASSED range min = 0 max = 100 PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/is_finite_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/is_finite_basic.phpt +++ php-src/ext/standard/tests/math/is_finite_basic.phpt --TEST-- Test is_finite() - basic function test is_finite() --FILE-- <?php $values = array(234, -234, 23.45e1, -23.45e1, 0xEA, 0352, "234", "234.5", "23.45e1", null, true, false, pow(0, -2), acos(1.01)); ; for ($i = 0; $i < count($values); $i++) { $res = is_finite($values[$i]); var_dump($res); } ?> --EXPECTF-- bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(false) bool(false) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/number_format_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/number_format_basic.phpt +++ php-src/ext/standard/tests/math/number_format_basic.phpt --TEST-- Test number_format() - basic function test number_format() --FILE-- <?php $values = array(1234.5678, -1234.5678, 1234.6578e4, -1234.56789e4, 0x1234CDEF, 02777777777, "123456789", "123.456789", "12.3456789e1", null, true, false); echo "\n number_format tests.....default\n"; for ($i = 0; $i < count($values); $i++) { $res = number_format($values[$i]); var_dump($res); } echo "\n number_format tests.....with two dp\n"; for ($i = 0; $i < count($values); $i++) { $res = number_format($values[$i], 2); var_dump($res); } echo "\n number_format tests.....English format\n"; for ($i = 0; $i < count($values); $i++) { $res = number_format($values[$i], 2, '.', ' '); var_dump($res); } echo "\n number_format tests.....French format\n"; for ($i = 0; $i < count($values); $i++) { $res = number_format($values[$i], 2, ',' , ' '); var_dump($res); } ?> --EXPECTF-- number_format tests.....default string(5) "1,235" string(6) "-1,235" string(10) "12,346,578" string(11) "-12,345,679" string(11) "305,450,479" string(11) "402,653,183" string(11) "123,456,789" string(3) "123" string(3) "123" string(1) "0" string(1) "1" string(1) "0" number_format tests.....with two dp string(8) "1,234.57" string(9) "-1,234.57" string(13) "12,346,578.00" string(14) "-12,345,678.90" string(14) "305,450,479.00" string(14) "402,653,183.00" string(14) "123,456,789.00" string(6) "123.46" string(6) "123.46" string(4) "0.00" string(4) "1.00" string(4) "0.00" number_format tests.....English format string(8) "1 234.57" string(9) "-1 234.57" string(13) "12 346 578.00" string(14) "-12 345 678.90" string(14) "305 450 479.00" string(14) "402 653 183.00" string(14) "123 456 789.00" string(6) "123.46" string(6) "123.46" string(4) "0.00" string(4) "1.00" string(4) "0.00" number_format tests.....French format string(8) "1 234,57" string(9) "-1 234,57" string(13) "12 346 578,00" string(14) "-12 345 678,90" string(14) "305 450 479,00" string(14) "402 653 183,00" string(14) "123 456 789,00" string(6) "123,46" string(6) "123,46" string(4) "0,00" string(4) "1,00" string(4) "0,00" --UEXPECTF-- number_format tests.....default unicode(5) "1,235" unicode(6) "-1,235" unicode(10) "12,346,578" unicode(11) "-12,345,679" unicode(11) "305,450,479" unicode(11) "402,653,183" unicode(11) "123,456,789" unicode(3) "123" unicode(3) "123" unicode(1) "0" unicode(1) "1" unicode(1) "0" number_format tests.....with two dp unicode(8) "1,234.57" unicode(9) "-1,234.57" unicode(13) "12,346,578.00" unicode(14) "-12,345,678.90" unicode(14) "305,450,479.00" unicode(14) "402,653,183.00" unicode(14) "123,456,789.00" unicode(6) "123.46" unicode(6) "123.46" unicode(4) "0.00" unicode(4) "1.00" unicode(4) "0.00" number_format tests.....English format unicode(8) "1 234.57" unicode(9) "-1 234.57" unicode(13) "12 346 578.00" unicode(14) "-12 345 678.90" unicode(14) "305 450 479.00" unicode(14) "402 653 183.00" unicode(14) "123 456 789.00" unicode(6) "123.46" unicode(6) "123.46" unicode(4) "0.00" unicode(4) "1.00" unicode(4) "0.00" number_format tests.....French format unicode(8) "1 234,57" unicode(9) "-1 234,57" unicode(13) "12 346 578,00" unicode(14) "-12 345 678,90" unicode(14) "305 450 479,00" unicode(14) "402 653 183,00" unicode(14) "123 456 789,00" unicode(6) "123,46" unicode(6) "123,46" unicode(4) "0,00" unicode(4) "1,00" unicode(4) "0,00" http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/is_finite_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/is_finite_error.phpt +++ php-src/ext/standard/tests/math/is_finite_error.phpt --TEST-- Test is_finite() - wrong params test is_finite() --FILE-- <?php is_finite(); is_finite(23,2,true); ?> --EXPECTF-- Warning: is_finite() expects exactly 1 parameter, 0 given in %s on line 2 Warning: is_finite() expects exactly 1 parameter, 3 given in %s on line 3 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/dechex_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/dechex_basic.phpt +++ php-src/ext/standard/tests/math/dechex_basic.phpt --TEST-- Test dechex() - basic function dechex() --FILE-- <?php $values = array(10, 3950.5, 3.9505e3, 039, 0x5F, "10", "3950.5", "3.9505e3", "039", "0x5F", true, false, null, ); for ($i = 0; $i < count($values); $i++) { $res = dechex($values[$i]); var_dump($res); } ?> --EXPECTF-- string(1) "a" string(3) "f6e" string(3) "f6e" string(1) "3" string(2) "5f" string(1) "a" string(3) "f6e" string(1) "3" string(2) "27" string(1) "0" string(1) "1" string(1) "0" string(1) "0" --UEXPECTF-- unicode(1) "a" unicode(3) "f6e" unicode(3) "f6e" unicode(1) "3" unicode(2) "5f" unicode(1) "a" unicode(3) "f6e" unicode(1) "3" unicode(2) "27" unicode(1) "0" unicode(1) "1" unicode(1) "0" unicode(1) "0" http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/pi_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/pi_basic.phpt +++ php-src/ext/standard/tests/math/pi_basic.phpt --TEST-- Test pi() - basic function test pi() --INI-- precision=14 --FILE-- <?php echo pi(), "\n"; echo M_PI, "\n"; // N.B pi() ignores all specified arguments no error // messages are produced if arguments are spcified. ?> --EXPECTF-- 3.1415926535898 3.1415926535898 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/log10_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/log10_basic.phpt +++ php-src/ext/standard/tests/math/log10_basic.phpt --TEST-- Test return type and value for expected input log10() --INI-- precision = 14 --FILE-- <?php /* * proto float log10(float number) * Function is implemented in ext/standard/math.c */ $file_path = dirname(__FILE__); require($file_path."/allowed_rounding_error.inc"); $arg_0 = 1.0; $arg_1 = 10.0; $arg_2 = 100.0; echo "log10 $arg_0 = "; $r0 = log10($arg_0); var_dump($r0); if (allowed_rounding_error($r0 ,0.0 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "log10 $arg_1 = "; $r1 = log10($arg_1); var_dump($r1); if (allowed_rounding_error($r1 ,1.0 )) { echo "Pass\n"; } else { echo "Fail\n"; } echo "log10 $arg_2 = "; $r2 = log10($arg_2); var_dump($r2); if (allowed_rounding_error($r2 ,2.0 )) { echo "Pass\n"; } else { echo "Fail\n"; } ?> --EXPECTF-- log10 1 = float(%f) Pass log10 10 = float(%f) Pass log10 100 = float(%f) Pass http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/deg2rad_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/deg2rad_error.phpt +++ php-src/ext/standard/tests/math/deg2rad_error.phpt --TEST-- Test wrong number of arguments for deg2rad() --INI-- precision = 14 --FILE-- <?php /* * proto float deg2rad(float number) * Function is implemented in ext/standard/math.c */ $arg_0 = 1.0; $extra_arg = 1; echo "\nToo many arguments\n"; var_dump(deg2rad($arg_0, $extra_arg)); echo "\nToo few arguments\n"; var_dump(deg2rad()); ?> --EXPECTF-- Too many arguments Warning: deg2rad() expects exactly 1 parameter, 2 given in %s on line 11 NULL Too few arguments Warning: deg2rad() expects exactly 1 parameter, 0 given in %s on line 14 NULL http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/is_infinite_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/is_infinite_error.phpt +++ php-src/ext/standard/tests/math/is_infinite_error.phpt --TEST-- Test is_infinite() - wrong params test is_infinite() --FILE-- <?php is_infinite(); is_infinite(23,2,true); ?> --EXPECTF-- Warning: is_infinite() expects exactly 1 parameter, 0 given in %s on line 2 Warning: is_infinite() expects exactly 1 parameter, 3 given in %s on line 3 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/deg2rad_variation.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/math/deg2rad_variation.phpt +++ php-src/ext/standard/tests/math/deg2rad_variation.phpt --TEST-- Test variations in usage of deg2rad() --INI-- precision = 10 --FILE-- <?php /* * proto float deg2rad(float number) * Function is implemented in ext/standard/math.c */ //Test deg2rad with a different input values $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 = deg2rad($values[$i]); var_dump($res); } ?> --EXPECTF-- float(0.401425728) float(-0.401425728) float(0.4092797096) float(-0.4092797096) float(0.401425728) float(0.401425728) float(0.401425728) float(0.4092797096) float(0.4092797096) Warning: deg2rad() expects parameter 1 to be double, string given in %s on line 27 NULL float(17.45329252) Notice: A non well formed numeric value encountered in %s on line 27 float(17.45329252) float(0) float(0.01745329252) float(0) --UEXPECTF-- float(0.401425728) float(-0.401425728) float(0.4092797096) float(-0.4092797096) float(0.401425728) float(0.401425728) float(0.401425728) float(0.4092797096) float(0.4092797096) Warning: deg2rad() expects parameter 1 to be double, Unicode string given in %s on line 27 NULL float(17.45329252) Notice: A non well formed numeric value encountered in %s on line 27 float(17.45329252) float(0) float(0.01745329252) float(0)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php