xref: /PHP-7.0/ext/gmp/tests/gmp_prob_prime.phpt (revision 9586b152)
1--TEST--
2gmp_prob_prime() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_prob_prime(10));
9var_dump(gmp_prob_prime("7"));
10var_dump(gmp_prob_prime(17));
11var_dump(gmp_prob_prime(-31));
12var_dump(gmp_prob_prime("172368715471481723"));
13
14var_dump(gmp_prob_prime(10));
15var_dump(gmp_prob_prime("7"));
16var_dump(gmp_prob_prime(17));
17var_dump(gmp_prob_prime(-31));
18var_dump(gmp_prob_prime("172368715471481723"));
19
20for ($i = -1; $i < 12; $i++) {
21	var_dump(gmp_prob_prime((773*$i)-($i*7)-1, $i));
22	$n = gmp_init("23476812735411");
23	var_dump(gmp_prob_prime(gmp_add($n, $i-1), $i));
24}
25
26$n = gmp_init("19481923");
27var_dump(gmp_prob_prime($n));
28$n = gmp_init(0);
29var_dump(gmp_prob_prime($n));
30
31var_dump(gmp_prob_prime());
32var_dump(gmp_prob_prime(array()));
33
34echo "Done\n";
35?>
36--EXPECTF--
37int(0)
38int(2)
39int(2)
40int(2)
41int(0)
42int(0)
43int(2)
44int(2)
45int(2)
46int(0)
47int(0)
48int(0)
49int(0)
50int(0)
51int(0)
52int(0)
53int(2)
54int(0)
55int(2)
56int(0)
57int(0)
58int(0)
59int(0)
60int(0)
61int(0)
62int(0)
63int(0)
64int(0)
65int(0)
66int(0)
67int(0)
68int(0)
69int(0)
70int(0)
71int(0)
72int(0)
73int(0)
74int(0)
75
76Warning: gmp_prob_prime() expects at least 1 parameter, 0 given in %s on line %d
77NULL
78
79Warning: gmp_prob_prime(): Unable to convert variable to GMP - wrong type in %s on line %d
80bool(false)
81Done
82