xref: /PHP-7.0/ext/gmp/tests/gmp_init.phpt (revision 9586b152)
1--TEST--
2gmp_init() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_init("98765678"));
9var_dump(gmp_strval(gmp_init("98765678")));
10var_dump(gmp_strval(gmp_init()));
11var_dump(gmp_init());
12var_dump(gmp_init(1,2,3,4));
13var_dump(gmp_init(1,-1));
14var_dump(gmp_init("",36));
15var_dump(gmp_init("foo",3));
16var_dump(gmp_strval(gmp_init("993247326237679187178",3)));
17
18echo "Done\n";
19?>
20--EXPECTF--
21object(GMP)#%d (1) {
22  ["num"]=>
23  string(8) "98765678"
24}
25string(8) "98765678"
26
27Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
28
29Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
30bool(false)
31
32Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
33NULL
34
35Warning: gmp_init() expects at most 2 parameters, 4 given in %s on line %d
36NULL
37
38Warning: gmp_init(): Bad base for conversion: -1 (should be between 2 and %d) in %s on line %d
39bool(false)
40
41Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in %s on line %d
42bool(false)
43
44Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in %s on line %d
45bool(false)
46
47Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in %s on line %d
48string(1) "0"
49Done
50