xref: /PHP-5.6/ext/gmp/tests/gmp_hamdist.phpt (revision 9586b152)
1--TEST--
2gmp_hamdist() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_hamdist(1231231, 0));
9var_dump(gmp_hamdist(1231231, -1));
10var_dump(gmp_hamdist(1231231, "8765434567897654333334567"));
11var_dump(gmp_hamdist(-364264234, "8333765434567897654333334567"));
12
13$n = gmp_init("8765434567");
14$n1 = gmp_init("987654445678");
15var_dump(gmp_hamdist($n, "8333765434567897654333334567"));
16var_dump(gmp_hamdist($n, $n));
17var_dump(gmp_hamdist($n, $n1));
18
19var_dump(gmp_hamdist($n, $n1, 1));
20var_dump(gmp_hamdist($n, array()));
21var_dump(gmp_hamdist(array(), $n));
22var_dump(gmp_hamdist(array(), array()));
23var_dump(gmp_hamdist());
24
25echo "Done\n";
26?>
27--EXPECTF--
28int(13)
29int(-1)
30int(36)
31int(-1)
32int(43)
33int(0)
34int(26)
35
36Warning: gmp_hamdist() expects exactly 2 parameters, 3 given in %s on line %d
37NULL
38
39Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
40bool(false)
41
42Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
43bool(false)
44
45Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
46bool(false)
47
48Warning: gmp_hamdist() expects exactly 2 parameters, 0 given in %s on line %d
49NULL
50Done
51