diff options
| author | SVN Migration <svn@php.net> | 2001-10-22 09:44:28 +0000 |
|---|---|---|
| committer | SVN Migration <svn@php.net> | 2001-10-22 09:44:28 +0000 |
| commit | 8b4d5cefea14a45129aa0d25bb8cea0852ba6e99 (patch) | |
| tree | bbb9b843fcc47a1ded1bfdc94c1284141d389604 | |
| parent | f10d1f8f01c2b447ab7974a1ba71be51d98ad238 (diff) | |
| download | php-git-8b4d5cefea14a45129aa0d25bb8cea0852ba6e99.tar.gz | |
This commit was manufactured by cvs2svn to create branch 'PHP_4_0_7'.
| -rw-r--r-- | ext/standard/tests/math/abs.phpt | 26 | ||||
| -rw-r--r-- | ext/standard/tests/math/round.phpt | 39 |
2 files changed, 65 insertions, 0 deletions
diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt new file mode 100644 index 0000000000..b5ffff37ab --- /dev/null +++ b/ext/standard/tests/math/abs.phpt @@ -0,0 +1,26 @@ +--TEST-- +Simple math tests +--POST-- +--GET-- +--FILE-- +<?php // $Id$ + +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('../../../../tests/quicktester.inc'); +--EXPECT-- +1,1,0,0 +OK diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt new file mode 100644 index 0000000000..bfb9750f06 --- /dev/null +++ b/ext/standard/tests/math/round.phpt @@ -0,0 +1,39 @@ +--TEST-- +Simple math tests +--POST-- +--GET-- +--FILE-- +<?php // $Id$ + +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 ~== ceil(-1.5) + 2 ~== ceil( 1.5) +-2 ~== floor(-1.5) + 1 ~== floor(1.5) + LONG_MIN ~== ceil(LONG_MIN - 0.5) + LONG_MIN+1 ~== ceil(LONG_MIN + 0.5) + LONG_MIN-1 ~== round(LONG_MIN - 0.6) + LONG_MIN ~== round(LONG_MIN - 0.4) + LONG_MIN ~== round(LONG_MIN + 0.4) + LONG_MIN+1 ~== round(LONG_MIN + 0.6) + LONG_MIN-1 ~== floor(LONG_MIN - 0.5) + LONG_MIN ~== floor(LONG_MIN + 0.5) + LONG_MAX ~== ceil(LONG_MAX - 0.5) + LONG_MAX+1 ~== ceil(LONG_MAX + 0.5) + LONG_MAX-1 ~== round(LONG_MAX - 0.6) + LONG_MAX ~== round(LONG_MAX - 0.4) + LONG_MAX ~== round(LONG_MAX + 0.4) + LONG_MAX+1 ~== round(LONG_MAX + 0.6) + LONG_MAX-1 ~== floor(LONG_MAX - 0.5) + LONG_MAX ~== floor(LONG_MAX + 0.5) +TESTS; + +include('../../../../tests/quicktester.inc'); +--EXPECT-- +1,1,0,0 +OK |
