xref: /PHP-7.2/ext/standard/tests/math/abs_error.phpt (revision 17ccbeec)
1--TEST--
2Test abs() function :  error conditions - incorrect number of args
3--FILE--
4<?php
5/* Prototype  : number abs  ( mixed $number  )
6 * Description: Returns the absolute value of number.
7 * Source code: ext/standard/math.c
8 */
9
10/*
11 * Pass incorrect number of arguments to abs() to test behaviour
12 */
13
14echo "*** Testing abs() : error conditions ***\n";
15
16$arg_0 = 1.0;
17$extra_arg = 1;
18
19echo "\nToo many arguments\n";
20var_dump(abs($arg_0, $extra_arg));
21
22echo "\nToo few arguments\n";
23var_dump(abs());
24
25?>
26===Done===
27--EXPECTF--
28*** Testing abs() : error conditions ***
29
30Too many arguments
31
32Warning: abs() expects exactly 1 parameter, 2 given in %s on line %d
33NULL
34
35Too few arguments
36
37Warning: abs() expects exactly 1 parameter, 0 given in %s on line %d
38NULL
39===Done===
40