xref: /PHP-5.3/ext/gmp/tests/031.phpt (revision eb5bd09c)
1--TEST--
2gmp_com() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_strval(gmp_com(0)));
9var_dump(gmp_strval(gmp_com("0")));
10var_dump(gmp_strval(gmp_com("test")));
11var_dump(gmp_strval(gmp_com("2394876545678")));
12var_dump(gmp_strval(gmp_com("-111")));
13var_dump(gmp_strval(gmp_com(874653)));
14var_dump(gmp_strval(gmp_com(-9876)));
15
16$n = gmp_init("98765467");
17var_dump(gmp_strval(gmp_com($n)));
18$n = gmp_init("98765463337");
19var_dump(gmp_strval(gmp_com($n)));
20
21var_dump(gmp_strval(gmp_com(array())));
22var_dump(gmp_strval(gmp_com()));
23
24echo "Done\n";
25?>
26--EXPECTF--
27string(2) "-1"
28string(2) "-1"
29string(1) "0"
30string(14) "-2394876545679"
31string(3) "110"
32string(7) "-874654"
33string(4) "9875"
34string(9) "-98765468"
35string(12) "-98765463338"
36
37Warning: gmp_com(): Unable to convert variable to GMP - wrong type in %s on line %d
38string(1) "0"
39
40Warning: gmp_com() expects exactly 1 parameter, 0 given in %s on line %d
41
42Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
43bool(false)
44Done
45