diff options
| author | Antony Dovgal <tony2001@php.net> | 2007-04-26 13:44:02 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2007-04-26 13:44:02 +0000 |
| commit | 3e7b4e5d1a5de612256b7324b5d8a22ca2cd34a3 (patch) | |
| tree | 48cbbedad11a0f1adcf23c38ae16200a470615d3 /ext/gmp/tests | |
| parent | 69cfe50f74a3625f6ba7cb48a393a3e23344a3de (diff) | |
| download | php-git-3e7b4e5d1a5de612256b7324b5d8a22ca2cd34a3.tar.gz | |
MFH: add test & GMP_VERSION constant
do not allow zero operand in gmp_divexact()
Diffstat (limited to 'ext/gmp/tests')
| -rw-r--r-- | ext/gmp/tests/011.phpt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ext/gmp/tests/011.phpt b/ext/gmp/tests/011.phpt new file mode 100644 index 0000000000..1f7097a0d8 --- /dev/null +++ b/ext/gmp/tests/011.phpt @@ -0,0 +1,41 @@ +--TEST-- +gmp_divexact() tests (OK to fail with GMP =< 4.2.1) +--FILE-- +<?php + +$r = gmp_divexact("233", "23345555555555555555555555"); +var_dump(gmp_strval($r)); + +$r = gmp_divexact("233", "0"); +var_dump(gmp_strval($r)); + +$r = gmp_divexact("100", "10"); +var_dump(gmp_strval($r)); + +$r = gmp_divexact("1024", "2"); +var_dump(gmp_strval($r)); + +$n = gmp_init("10000000000000000000"); +$r = gmp_divexact($n, "2"); +var_dump(gmp_strval($r)); + +$r = gmp_divexact($n, "50"); +var_dump(gmp_strval($r)); + +$n1 = gmp_init("-100000000000000000000000000"); +$r = gmp_divexact($n1, $n); +var_dump(gmp_strval($r)); + +echo "Done\n"; +?> +--EXPECTF-- +string(1) "0" + +Warning: gmp_divexact(): Zero operand not allowed in %s on line %d +string(1) "0" +string(2) "10" +string(3) "512" +string(19) "5000000000000000000" +string(18) "200000000000000000" +string(9) "-10000000" +Done |
