gmp_div_r.phpt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --TEST--
  2. gmp_div_r() tests
  3. --SKIPIF--
  4. <?php if (!extension_loaded("gmp")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. var_dump(gmp_div_r());
  8. var_dump(gmp_div_r(""));
  9. var_dump($r = gmp_div_r(0,1));
  10. var_dump($r = gmp_div_r(1,0));
  11. var_dump($r = gmp_div_r(12653,23482734));
  12. var_dump($r = gmp_div_r(12653,23482734, 10));
  13. var_dump($r = gmp_div_r(1123123,123));
  14. var_dump($r = gmp_div_r(1123123,123, 1));
  15. var_dump($r = gmp_div_r(1123123,123, 2));
  16. var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_ZERO));
  17. var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_PLUSINF));
  18. var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_MINUSINF));
  19. $fp = fopen(__FILE__, 'r');
  20. var_dump(gmp_div_r($fp, $fp));
  21. var_dump(gmp_div_r(array(), array()));
  22. echo "Done\n";
  23. ?>
  24. --EXPECTF--
  25. Warning: gmp_div_r() expects at least 2 parameters, 0 given in %s on line %d
  26. NULL
  27. Warning: gmp_div_r() expects at least 2 parameters, 1 given in %s on line %d
  28. NULL
  29. object(GMP)#%d (1) {
  30. ["num"]=>
  31. string(1) "0"
  32. }
  33. Warning: gmp_div_r(): Zero operand not allowed in %s on line %d
  34. bool(false)
  35. object(GMP)#%d (1) {
  36. ["num"]=>
  37. string(5) "12653"
  38. }
  39. Warning: gmp_div_r(): Invalid rounding mode in %s on line %d
  40. bool(false)
  41. object(GMP)#%d (1) {
  42. ["num"]=>
  43. string(2) "10"
  44. }
  45. object(GMP)#%d (1) {
  46. ["num"]=>
  47. string(4) "-113"
  48. }
  49. object(GMP)#%d (1) {
  50. ["num"]=>
  51. string(2) "10"
  52. }
  53. object(GMP)#%d (1) {
  54. ["num"]=>
  55. string(2) "10"
  56. }
  57. object(GMP)#%d (1) {
  58. ["num"]=>
  59. string(4) "-113"
  60. }
  61. object(GMP)#%d (1) {
  62. ["num"]=>
  63. string(2) "10"
  64. }
  65. Warning: gmp_div_r(): Unable to convert variable to GMP - wrong type in %s on line %d
  66. bool(false)
  67. Warning: gmp_div_r(): Unable to convert variable to GMP - wrong type in %s on line %d
  68. bool(false)
  69. Done