Annotation of embedaddon/php/ext/gmp/tests/015.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: gmp_pow() basic tests
3: --SKIPIF--
4: <?php if (!extension_loaded("gmp")) print "skip"; ?>
5: --FILE--
6: <?php
7:
8: var_dump(gmp_strval(gmp_pow(2,10)));
9: var_dump(gmp_strval(gmp_pow(-2,10)));
10: var_dump(gmp_strval(gmp_pow(-2,11)));
11: var_dump(gmp_strval(gmp_pow("2",10)));
12: var_dump(gmp_strval(gmp_pow("2",0)));
13: var_dump(gmp_strval(gmp_pow("2",-1)));
14: var_dump(gmp_strval(gmp_pow("-2",10)));
15: var_dump(gmp_strval(gmp_pow(20,10)));
16: var_dump(gmp_strval(gmp_pow(50,10)));
17: var_dump(gmp_strval(gmp_pow(50,-5)));
18:
19: $n = gmp_init("20");
20: var_dump(gmp_strval(gmp_pow($n,10)));
21: $n = gmp_init("-20");
22: var_dump(gmp_strval(gmp_pow($n,10)));
23:
24: var_dump(gmp_pow(2,10,1));
25: var_dump(gmp_pow(2));
26: var_dump(gmp_pow());
27: var_dump(gmp_pow(array(), array()));
28: var_dump(gmp_pow(2,array()));
29: var_dump(gmp_pow(array(),10));
30:
31: echo "Done\n";
32: ?>
33: --EXPECTF--
34: string(4) "1024"
35: string(4) "1024"
36: string(5) "-2048"
37: string(4) "1024"
38: string(1) "1"
39:
40: Warning: gmp_pow(): Negative exponent not supported in %s on line %d
41: string(1) "0"
42: string(4) "1024"
43: string(14) "10240000000000"
44: string(17) "97656250000000000"
45:
46: Warning: gmp_pow(): Negative exponent not supported in %s on line %d
47: string(1) "0"
48: string(14) "10240000000000"
49: string(14) "10240000000000"
50:
51: Warning: gmp_pow() expects exactly 2 parameters, 3 given in %s on line %d
52: NULL
53:
54: Warning: gmp_pow() expects exactly 2 parameters, 1 given in %s on line %d
55: NULL
56:
57: Warning: gmp_pow() expects exactly 2 parameters, 0 given in %s on line %d
58: NULL
59:
60: Warning: gmp_pow() expects parameter 2 to be long, array given in %s on line %d
61: NULL
62:
63: Warning: gmp_pow() expects parameter 2 to be long, array given in %s on line %d
64: NULL
65:
66: Warning: gmp_pow(): Unable to convert variable to GMP - wrong type in %s on line %d
67: bool(false)
68: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>