File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
gmp /
tests /
039.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:56 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
gmp_testbit() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
$n = gmp_init(0);
var_dump(gmp_testbit($n, -10));
var_dump(gmp_testbit($n, 0));
var_dump(gmp_testbit($n, 1));
var_dump(gmp_testbit($n, 100));
$n = gmp_init(-1);
var_dump(gmp_testbit($n, 1));
var_dump(gmp_testbit($n, -1));
$n = gmp_init("1000000");
var_dump(gmp_testbit($n, 1));
gmp_setbit($n, 1);
var_dump(gmp_testbit($n, 1));
var_dump(gmp_strval($n));
gmp_setbit($n, 5);
var_dump(gmp_testbit($n, 5));
var_dump(gmp_strval($n));
$n = gmp_init("238462734628347239571823641234");
var_dump(gmp_testbit($n, 5));
gmp_setbit($n, 5);
var_dump(gmp_testbit($n, 5));
var_dump(gmp_strval($n));
gmp_clrbit($n, 5);
var_dump(gmp_testbit($n, 5));
var_dump(gmp_strval($n));
echo "Done\n";
?>
--EXPECTF--
Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
bool(false)
bool(false)
bool(false)
bool(false)
bool(true)
Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
bool(false)
bool(false)
bool(true)
string(7) "1000002"
bool(true)
string(7) "1000034"
bool(false)
bool(true)
string(30) "238462734628347239571823641266"
bool(false)
string(30) "238462734628347239571823641234"
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>