Annotation of embedaddon/php/ext/gmp/tests/039.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: gmp_testbit() basic tests
3: --SKIPIF--
4: <?php if (!extension_loaded("gmp")) print "skip"; ?>
5: --FILE--
6: <?php
7:
8: $n = gmp_init(0);
9: var_dump(gmp_testbit($n, -10));
10: var_dump(gmp_testbit($n, 0));
11: var_dump(gmp_testbit($n, 1));
12: var_dump(gmp_testbit($n, 100));
13:
14: $n = gmp_init(-1);
15: var_dump(gmp_testbit($n, 1));
16: var_dump(gmp_testbit($n, -1));
17:
18: $n = gmp_init("1000000");
19: var_dump(gmp_testbit($n, 1));
20: gmp_setbit($n, 1);
21: var_dump(gmp_testbit($n, 1));
22: var_dump(gmp_strval($n));
23:
24: gmp_setbit($n, 5);
25: var_dump(gmp_testbit($n, 5));
26: var_dump(gmp_strval($n));
27:
28: $n = gmp_init("238462734628347239571823641234");
29: var_dump(gmp_testbit($n, 5));
30: gmp_setbit($n, 5);
31: var_dump(gmp_testbit($n, 5));
32: var_dump(gmp_strval($n));
33:
34: gmp_clrbit($n, 5);
35: var_dump(gmp_testbit($n, 5));
36: var_dump(gmp_strval($n));
37:
38: echo "Done\n";
39: ?>
40: --EXPECTF--
41: Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
42: bool(false)
43: bool(false)
44: bool(false)
45: bool(false)
46: bool(true)
47:
48: Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
49: bool(false)
50: bool(false)
51: bool(true)
52: string(7) "1000002"
53: bool(true)
54: string(7) "1000034"
55: bool(false)
56: bool(true)
57: string(30) "238462734628347239571823641266"
58: bool(false)
59: string(30) "238462734628347239571823641234"
60: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>