xref: /PHP-5.3/ext/gmp/tests/029.phpt (revision eb5bd09c)
1--TEST--
2gmp_and() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_strval(gmp_and("111111", "2222222")));
9var_dump(gmp_strval(gmp_and(123123, 435234)));
10var_dump(gmp_strval(gmp_and(555, "2342341123")));
11var_dump(gmp_strval(gmp_and(-1, 3333)));
12var_dump(gmp_strval(gmp_and(4545, -20)));
13var_dump(gmp_strval(gmp_and("test", "no test")));
14
15$n = gmp_init("987657876543456");
16var_dump(gmp_strval(gmp_and($n, "34332")));
17$n1 = gmp_init("987657878765436543456");
18var_dump(gmp_strval(gmp_and($n, $n1)));
19
20var_dump(gmp_and($n, $n1, 1));
21var_dump(gmp_and(1));
22var_dump(gmp_and(array(), 1));
23var_dump(gmp_and(1, array()));
24var_dump(gmp_and(array(), array()));
25
26echo "Done\n";
27?>
28--EXPECTF--
29string(6) "106502"
30string(5) "40994"
31string(3) "515"
32string(4) "3333"
33string(4) "4544"
34string(1) "0"
35string(4) "1536"
36string(15) "424703623692768"
37
38Warning: gmp_and() expects exactly 2 parameters, 3 given in %s on line %d
39NULL
40
41Warning: gmp_and() expects exactly 2 parameters, 1 given in %s on line %d
42NULL
43
44Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d
45bool(false)
46
47Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d
48bool(false)
49
50Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d
51bool(false)
52Done
53