xref: /PHP-8.2/ext/gmp/tests/gmp_scan1.phpt (revision e9f783fc)
1--TEST--
2gmp_scan1() basic tests
3--EXTENSIONS--
4gmp
5--FILE--
6<?php
7
8try {
9    var_dump(gmp_scan1("434234", -10));
10} catch (\ValueError $e) {
11    echo $e->getMessage() . \PHP_EOL;
12}
13
14var_dump(gmp_scan1("434234", 1));
15var_dump(gmp_scan1(4096, 0));
16var_dump(gmp_scan1("1000000000", 5));
17var_dump(gmp_scan1("1000000000", 200));
18
19$n = gmp_init("24234527465274");
20var_dump(gmp_scan1($n, 10));
21
22try {
23    var_dump(gmp_scan1(array(), 200));
24} catch (\TypeError $e) {
25    echo $e->getMessage() . \PHP_EOL;
26}
27
28echo "Done\n";
29?>
30--EXPECT--
31gmp_scan1(): Argument #2 ($start) must be greater than or equal to 0
32int(1)
33int(12)
34int(9)
35int(-1)
36int(10)
37gmp_scan1(): Argument #1 ($num1) must be of type GMP|string|int, array given
38Done
39