PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/standard/tests/math/abs.php

http://github.com/facebook/hiphop-php
PHP | 18 lines | 15 code | 3 blank | 0 comment | 0 complexity | 46d89b35ad15735be46388b97f5478ba MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php // $Id$
  2. define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
  3. define('LONG_MIN', -LONG_MAX - 1);
  4. printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
  5. is_int(LONG_MIN-1),is_int(LONG_MAX+1));
  6. $tests = <<<TESTS
  7. 1 === abs(-1)
  8. 1.5 === abs(-1.5)
  9. 1 === abs("-1")
  10. 1.5 === abs("-1.5")
  11. -LONG_MIN+1 === abs(LONG_MIN-1)
  12. -LONG_MIN === abs(LONG_MIN)
  13. -(LONG_MIN+1) === abs(LONG_MIN+1)
  14. TESTS;
  15. include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');