xref: /PHP-7.4/ext/gmp/tests/gmp_scan1.phpt (revision 782352c5)
1--TEST--
2gmp_scan1() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_scan1("434234", -10));
9var_dump(gmp_scan1("434234", 1));
10var_dump(gmp_scan1(4096, 0));
11var_dump(gmp_scan1("1000000000", 5));
12var_dump(gmp_scan1("1000000000", 200));
13
14$n = gmp_init("24234527465274");
15var_dump(gmp_scan1($n, 10));
16
17var_dump(gmp_scan1(array(), 200));
18var_dump(gmp_scan1(array()));
19var_dump(gmp_scan1());
20
21echo "Done\n";
22?>
23--EXPECTF--
24Warning: gmp_scan1(): Starting index must be greater than or equal to zero in %s on line %d
25bool(false)
26int(1)
27int(12)
28int(9)
29int(-1)
30int(10)
31
32Warning: gmp_scan1(): Unable to convert variable to GMP - wrong type in %s on line %d
33bool(false)
34
35Warning: gmp_scan1() expects exactly 2 parameters, 1 given in %s on line %d
36NULL
37
38Warning: gmp_scan1() expects exactly 2 parameters, 0 given in %s on line %d
39NULL
40Done
41