File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
math /
round.phpt
Revision
1.1.1.2 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 3 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--TEST--
Simple math tests
--FILE--
<?php // $Id: round.phpt,v 1.1.1.2 2012/05/29 12:34:45 misho Exp $
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(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
--EXPECT--
1,1,0,0
OK
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>