xref: /PHP-7.4/ext/gmp/tests/gmp_popcount.phpt (revision 782352c5)
1--TEST--
2gmp_popcount() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_popcount(-1));
9var_dump(gmp_popcount(0));
10var_dump(gmp_popcount(12123));
11var_dump(gmp_popcount("52638927634234"));
12var_dump(gmp_popcount("-23476123423433"));
13$n = gmp_init("9876546789222");
14var_dump(gmp_popcount($n));
15var_dump(gmp_popcount(array()));
16var_dump(gmp_popcount());
17
18echo "Done\n";
19?>
20--EXPECTF--
21int(-1)
22int(0)
23int(10)
24int(31)
25int(-1)
26int(20)
27
28Warning: gmp_popcount(): Unable to convert variable to GMP - wrong type in %s on line %d
29bool(false)
30
31Warning: gmp_popcount() expects exactly 1 parameter, 0 given in %s on line %d
32NULL
33Done
34