xref: /PHP-5.6/ext/gmp/tests/gmp_fact.phpt (revision 9586b152)
1--TEST--
2gmp_fact() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_strval(gmp_fact(0)));
9var_dump(gmp_strval(gmp_fact("")));
10var_dump(gmp_strval(gmp_fact("0")));
11var_dump(gmp_strval(gmp_fact("-1")));
12var_dump(gmp_strval(gmp_fact(-1)));
13var_dump(gmp_strval(gmp_fact(1.1)));
14var_dump(gmp_strval(gmp_fact(20)));
15var_dump(gmp_strval(gmp_fact("50")));
16var_dump(gmp_strval(gmp_fact("10")));
17var_dump(gmp_strval(gmp_fact("0000")));
18
19$n = gmp_init(12);
20var_dump(gmp_strval(gmp_fact($n)));
21$n = gmp_init(-10);
22var_dump(gmp_strval(gmp_fact($n)));
23
24var_dump(gmp_fact());
25var_dump(gmp_fact(1,1));
26var_dump(gmp_fact(array()));
27var_dump(gmp_strval(gmp_fact(array())));
28
29echo "Done\n";
30?>
31--EXPECTF--
32string(1) "1"
33string(1) "1"
34string(1) "1"
35
36Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d
37string(1) "0"
38
39Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d
40string(1) "0"
41string(1) "1"
42string(19) "2432902008176640000"
43string(65) "30414093201713378043612608166064768844377641568960512000000000000"
44string(7) "3628800"
45string(1) "1"
46string(9) "479001600"
47
48Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d
49string(1) "0"
50
51Warning: gmp_fact() expects exactly 1 parameter, 0 given in %s on line %d
52NULL
53
54Warning: gmp_fact() expects exactly 1 parameter, 2 given in %s on line %d
55NULL
56object(GMP)#%d (1) {
57  ["num"]=>
58  string(1) "1"
59}
60string(1) "1"
61Done
62