xref: /PHP-7.4/ext/gmp/tests/gmp_random.phpt (revision 782352c5)
1--TEST--
2gmp_random() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_strval(gmp_random()));
9var_dump(gmp_strval(gmp_random(-1)));
10var_dump(gmp_strval(gmp_random(0)));
11var_dump(gmp_strval(gmp_random(10)));
12var_dump(gmp_strval(gmp_random("-10")));
13var_dump(gmp_strval(gmp_random(-10)));
14
15var_dump(gmp_random(array()));
16var_dump(gmp_random(array(),1));
17var_dump(gmp_random(""));
18var_dump(gmp_random("test"));
19
20echo "Done\n";
21?>
22--EXPECTF--
23Deprecated: Function gmp_random() is deprecated in %s on line %d
24string(%d) "%d"
25
26Deprecated: Function gmp_random() is deprecated in %s on line %d
27string(%d) "%d"
28
29Deprecated: Function gmp_random() is deprecated in %s on line %d
30string(1) "%d"
31
32Deprecated: Function gmp_random() is deprecated in %s on line %d
33string(%d) "%d"
34
35Deprecated: Function gmp_random() is deprecated in %s on line %d
36string(%d) "%d"
37
38Deprecated: Function gmp_random() is deprecated in %s on line %d
39string(%d) "%d"
40
41Deprecated: Function gmp_random() is deprecated in %s on line %d
42
43Warning: gmp_random() expects parameter 1 to be int, array given in %s on line %d
44NULL
45
46Deprecated: Function gmp_random() is deprecated in %s on line %d
47
48Warning: gmp_random() expects at most 1 parameter, 2 given in %s on line %d
49NULL
50
51Deprecated: Function gmp_random() is deprecated in %s on line %d
52
53Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d
54NULL
55
56Deprecated: Function gmp_random() is deprecated in %s on line %d
57
58Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d
59NULL
60Done
61