xref: /PHP-7.1/ext/gmp/tests/gmp_clrbit.phpt (revision 581c86c0)
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);
13var_dump(gmp_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
42bool(false)
43string(2) "-1"
44
45Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line %d
46string(7) "1000000"
47string(7) "1000000"
48string(30) "238462734628347239571822592658"
49
50Warning: gmp_clrbit() expects parameter 1 to be GMP, array given in %s on line %d
51
52Warning: gmp_clrbit() expects exactly 2 parameters, 3 given in %s on line %d
53
54Warning: gmp_clrbit() expects exactly 2 parameters, 1 given in %s on line %d
55
56Warning: gmp_clrbit() expects exactly 2 parameters, 0 given in %s on line %d
57Done
58