summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/abs.phpt
blob: 9350fc71fb0ed835f6cdd6b9889b1a3a5912da07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
Simple math tests
--FILE--
<?php

define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
define('LONG_MIN', -LONG_MAX - 1);
printf("%d,%d,%d,%d\n",is_int(LONG_MIN  ),is_int(LONG_MAX  ),
					   is_int(LONG_MIN-1),is_int(LONG_MAX+1));

$tests = <<<TESTS
 1   === abs(-1)
 1.5 === abs(-1.5)
 1   === abs("-1")
 1.5 === abs("-1.5")
-LONG_MIN+1 === abs(LONG_MIN-1)
-LONG_MIN   === abs(LONG_MIN)
-(LONG_MIN+1) === abs(LONG_MIN+1)
TESTS;

include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
--EXPECT--
1,1,0,0
OK