xref: /PHP-5.4/ext/gmp/tests/014.phpt (revision eb5bd09c)
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(11) "87178291200"
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
56resource(%d) of type (GMP integer)
57string(1) "1"
58Done
59