Annotation of embedaddon/php/ext/gmp/tests/003.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Check for number base recognition
3: --SKIPIF--
4: <?php if (!extension_loaded("gmp")) print "skip"; ?>
5: --FILE--
6: <?php
7: /* Binary */
8: $test[] = gmp_init("0b10011010010");
9: $test[] = gmp_init("0b10011010010", 2);
10: $test[] = gmp_init("10011010010");
11: $test[] = gmp_init("10011010010", 2);
12:
13: /* Octal */
14: $test[] = gmp_init("02322");
15: $test[] = gmp_init("02322", 8);
16: $test[] = gmp_init("2322");
17: $test[] = gmp_init("2322", 8);
18:
19: /* Decimal */
20: $test[] = gmp_init("1234");
21: $test[] = gmp_init("1234", 10);
22:
23: /* Hexidecimal */
24: $test[] = gmp_init("0x4d2");
25: $test[] = gmp_init("0x4d2", 16);
26: $test[] = gmp_init("4d2");
27: $test[] = gmp_init("4d2", 16);
28:
29: for ($i = 0; $i < count($test); $i++) {
30: printf("%s\n", gmp_strval($test[$i]));
31: }
32: ?>
33: --EXPECT--
34: 1234
35: 1234
36: 10011010010
37: 1234
38: 1234
39: 1234
40: 2322
41: 1234
42: 1234
43: 1234
44: 1234
45: 1234
46: 0
47: 1234
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>