ceil_basic.phpt 1013 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --TEST--
  2. Test ceil() - basic function test for ceil()
  3. --INI--
  4. precision=14
  5. --SKIPIF--
  6. if (strtolower(PHP_OS) == 'darwin') {
  7. die('SKIP OSX does weird things with -0 so this test doesn't work there');
  8. }
  9. --FILE--
  10. <?php
  11. /* Prototype : float ceil ( float $value )
  12. * Description: Round fractions up.
  13. * Source code: ext/standard/math.c
  14. */
  15. echo "*** Testing ceil() : basic functionality ***\n";
  16. $values = array(0,
  17. -0,
  18. 0.5,
  19. -0.5,
  20. 1,
  21. -1,
  22. 1.5,
  23. -1.5,
  24. 2.6,
  25. -2.6,
  26. 037,
  27. 0x5F,
  28. "10.5",
  29. "-10.5",
  30. "3.95E3",
  31. "-3.95E3",
  32. "039",
  33. "0x5F",
  34. true,
  35. false,
  36. null,
  37. );
  38. for ($i = 0; $i < count($values); $i++) {
  39. $res = ceil($values[$i]);
  40. var_dump($res);
  41. }
  42. ?>
  43. ===Done===
  44. --EXPECTF--
  45. *** Testing ceil() : basic functionality ***
  46. float(0)
  47. float(0)
  48. float(1)
  49. float(-0)
  50. float(1)
  51. float(-1)
  52. float(2)
  53. float(-1)
  54. float(3)
  55. float(-2)
  56. float(31)
  57. float(95)
  58. float(11)
  59. float(-10)
  60. float(3950)
  61. float(-3950)
  62. float(39)
  63. float(95)
  64. float(1)
  65. float(0)
  66. float(0)
  67. ===Done===