Return to abs.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / math |
1.1 misho 1: --TEST-- 2: Simple math tests 3: --FILE-- 4: <?php // $Id: abs.phpt 242949 2007-09-26 15:44:16Z cvs2svn $ 5: 6: define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF); 7: define('LONG_MIN', -LONG_MAX - 1); 8: printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ), 9: is_int(LONG_MIN-1),is_int(LONG_MAX+1)); 10: 11: $tests = <<<TESTS 12: 1 === abs(-1) 13: 1.5 === abs(-1.5) 14: 1 === abs("-1") 15: 1.5 === abs("-1.5") 16: -LONG_MIN+1 === abs(LONG_MIN-1) 17: -LONG_MIN === abs(LONG_MIN) 18: -(LONG_MIN+1) === abs(LONG_MIN+1) 19: TESTS; 20: 21: include(dirname(__FILE__) . '/../../../../tests/quicktester.inc'); 22: --EXPECT-- 23: 1,1,0,0 24: OK