xref: /PHP-5.6/ext/gmp/tests/gmp_legendre.phpt (revision 9586b152)
1--TEST--
2gmp_legendre() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8for ($i = -1; $i < 10; $i++) {
9	var_dump(gmp_strval(gmp_legendre(($i*$i)-1, 3)));
10}
11
12var_dump(gmp_strval(gmp_legendre(7, 23)));
13var_dump(gmp_strval(gmp_legendre("733535124", "1234123423434535623")));
14var_dump(gmp_strval(gmp_legendre(3, "1234123423434535623")));
15
16$n = "123123";
17$n1 = "1231231";
18
19var_dump(gmp_strval(gmp_legendre($n, $n1)));
20var_dump(gmp_strval(gmp_legendre($n, 3)));
21var_dump(gmp_strval(gmp_legendre(3, $n1)));
22
23var_dump(gmp_legendre(3, array()));
24var_dump(gmp_legendre(array(), 3));
25var_dump(gmp_legendre(array(), array()));
26
27var_dump(gmp_legendre(array(), array(), 1));
28var_dump(gmp_legendre(array()));
29var_dump(gmp_legendre());
30
31echo "Done\n";
32?>
33--EXPECTF--
34string(1) "0"
35string(2) "-1"
36string(1) "0"
37string(1) "0"
38string(2) "-1"
39string(1) "0"
40string(1) "0"
41string(2) "-1"
42string(1) "0"
43string(1) "0"
44string(2) "-1"
45string(2) "-1"
46string(1) "0"
47string(1) "0"
48string(2) "-1"
49string(1) "0"
50string(2) "-1"
51
52Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
53bool(false)
54
55Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
56bool(false)
57
58Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
59bool(false)
60
61Warning: gmp_legendre() expects exactly 2 parameters, 3 given in %s on line %d
62NULL
63
64Warning: gmp_legendre() expects exactly 2 parameters, 1 given in %s on line %d
65NULL
66
67Warning: gmp_legendre() expects exactly 2 parameters, 0 given in %s on line %d
68NULL
69Done
70