xref: /PHP-7.0/ext/gmp/tests/gmp_nextprime.phpt (revision 5408f1e5)
1--TEST--
2gmp_nextprime()
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip";
5?>
6--FILE--
7<?php
8
9$n = gmp_nextprime(-1);
10var_dump(gmp_strval($n));
11$n = gmp_nextprime(0);
12var_dump(gmp_strval($n));
13$n = gmp_nextprime(-1000);
14var_dump(gmp_strval($n));
15$n = gmp_nextprime(1000);
16var_dump(gmp_strval($n));
17$n = gmp_nextprime(100000);
18var_dump(gmp_strval($n));
19$n = gmp_nextprime(array());
20var_dump(gmp_strval($n));
21$n = gmp_nextprime("");
22var_dump(gmp_strval($n));
23$n = gmp_nextprime(new stdclass());
24var_dump(gmp_strval($n));
25
26echo "Done\n";
27?>
28--EXPECTF--
29string(1) "2"
30string(1) "2"
31string(1) "2"
32string(4) "1009"
33string(6) "100003"
34
35Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d
36string(1) "0"
37
38Warning: gmp_nextprime(): Unable to convert variable to GMP - string is not an integer in %s on line %d
39string(1) "0"
40
41Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d
42string(1) "0"
43Done
44