xref: /PHP-5.3/ext/standard/tests/math/abs.phpt (revision 29cfd6d2)
1--TEST--
2Simple math tests
3--FILE--
4<?php // $Id$
5
6define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
7define('LONG_MIN', -LONG_MAX - 1);
8printf("%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)
19TESTS;
20
21include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
22--EXPECT--
231,1,0,0
24OK
25