xref: /PHP-5.6/ext/gmp/tests/gmp_clrbit.phpt (revision 9586b152)
1--TEST--
2gmp_clrbit() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8$n = gmp_init(0);
9gmp_clrbit($n, 0);
10var_dump(gmp_strval($n));
11
12$n = gmp_init(-1);
13gmp_clrbit($n, -1);
14var_dump(gmp_strval($n));
15
16$n = gmp_init("1000000");
17gmp_clrbit($n, -1);
18var_dump(gmp_strval($n));
19
20$n = gmp_init("1000000");
21gmp_clrbit($n, 3);
22var_dump(gmp_strval($n));
23
24$n = gmp_init("238462734628347239571823641234");
25gmp_clrbit($n, 3);
26gmp_clrbit($n, 5);
27gmp_clrbit($n, 20);
28var_dump(gmp_strval($n));
29
30$n = array();
31gmp_clrbit($n, 3);
32gmp_clrbit($n, 3, 1);
33gmp_clrbit($n);
34gmp_clrbit();
35
36echo "Done\n";
37?>
38--EXPECTF--
39string(1) "0"
40
41Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d
42string(2) "-1"
43
44Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d
45string(7) "1000000"
46string(7) "1000000"
47string(30) "238462734628347239571822592658"
48
49Warning: gmp_clrbit() expects parameter 1 to be GMP, array given in %s on line %d
50
51Warning: gmp_clrbit() expects exactly 2 parameters, 3 given in %s on line %d
52
53Warning: gmp_clrbit() expects exactly 2 parameters, 1 given in %s on line %d
54
55Warning: gmp_clrbit() expects exactly 2 parameters, 0 given in %s on line %d
56Done
57