Skip to content

Commit 7c73e99

Browse files
committed
ext/standard/tests/math: Fix tests and remove ZPP tests
1 parent 326ee41 commit 7c73e99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+870
-4347
lines changed
Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,23 @@
11
--TEST--
22
Test abs() function : basic functionality
33
--INI--
4-
precision = 14
4+
precision=14
55
--FILE--
66
<?php
7-
echo "*** Testing abs() : basic functionality ***\n";
87

9-
$values = array(23,
10-
-23,
11-
2.345e1,
12-
-2.345e1,
13-
0x17,
14-
027,
15-
"23",
16-
"-23",
17-
"23.45",
18-
"2.345e1",
19-
"-2.345e1",
20-
null,
21-
true,
22-
false);
8+
$values = include 'data/numbers.inc';
239

24-
for ($i = 0; $i < count($values); $i++) {
25-
$res = abs($values[$i]);
10+
foreach ($values as $value) {
11+
$res = abs($value);
2612
var_dump($res);
2713
}
2814
?>
29-
--EXPECTF--
30-
*** Testing abs() : basic functionality ***
15+
--EXPECT--
3116
int(23)
3217
int(23)
3318
float(23.45)
3419
float(23.45)
35-
int(23)
36-
int(23)
37-
int(23)
38-
int(23)
3920
float(23.45)
40-
float(23.45)
41-
float(23.45)
42-
43-
Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
44-
int(0)
45-
int(1)
46-
int(0)
21+
int(10)
22+
float(10.3)
23+
float(3950.5)

ext/standard/tests/math/abs_variation.phpt

Lines changed: 0 additions & 138 deletions
This file was deleted.
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
11
--TEST--
22
Test variations in usage of acos()
33
--INI--
4-
precision=10
4+
precision=14
55
--FILE--
66
<?php
7-
/*
8-
* Function is implemented in ext/standard/math.c
9-
*/
107

8+
$values = include 'data/numbers.inc';
119

12-
//Test acos with a different input values
13-
14-
$values = array(23,
15-
-23,
16-
2.345e1,
17-
-2.345e1,
18-
0x17,
19-
027,
20-
"23",
21-
"23.45",
22-
"2.345e1",
23-
"1000",
24-
true,
25-
false);
26-
27-
for ($i = 0; $i < count($values); $i++) {
28-
$res = acos($values[$i]);
10+
foreach ($values as $value) {
11+
$res = acos($value);
2912
var_dump($res);
3013
}
3114

@@ -39,7 +22,3 @@ float(NAN)
3922
float(NAN)
4023
float(NAN)
4124
float(NAN)
42-
float(NAN)
43-
float(NAN)
44-
float(0)
45-
float(1.5707963267948966)
Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
11
--TEST--
22
Test variations in usage of acosh()
33
--INI--
4-
precision = 10
4+
precision=14
55
--FILE--
66
<?php
7-
/*
8-
* Function is implemented in ext/standard/math.c
9-
*/
107

8+
$values = include 'data/numbers.inc';
119

12-
//Test acosh with a different input values
13-
14-
$values = array(23,
15-
-23,
16-
2.345e1,
17-
-2.345e1,
18-
0x17,
19-
027,
20-
"23",
21-
"23.45",
22-
"2.345e1",
23-
"1000",
24-
true,
25-
false);
26-
27-
for ($i = 0; $i < count($values); $i++) {
28-
$res = acosh($values[$i]);
10+
foreach ($values as $value) {
11+
$res = acosh($value);
2912
var_dump($res);
3013
}
3114

@@ -34,12 +17,8 @@ for ($i = 0; $i < count($values); $i++) {
3417
float(3.8281684713331012)
3518
float(NAN)
3619
float(3.8475627390640357)
37-
float(NAN)
38-
float(3.8281684713331012)
39-
float(3.8281684713331012)
40-
float(3.8281684713331012)
41-
float(3.8475627390640357)
4220
float(3.8475627390640357)
43-
float(7.600902209541989)
44-
float(0)
4521
float(NAN)
22+
float(2.993222846126381)
23+
float(3.0229262125659933)
24+
float(8.974744596703715)
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
11
--TEST--
22
Test variations in usage of asin()
33
--INI--
4-
precision = 10
4+
precision=14
55
--FILE--
66
<?php
7-
/*
8-
* Function is implemented in ext/standard/math.c
9-
*/
107

8+
$values = include 'data/numbers.inc';
119

12-
//Test asin with a different input values
13-
14-
$values = array(23,
15-
-23,
16-
2.345e1,
17-
-2.345e1,
18-
0x17,
19-
027,
20-
"23",
21-
"23.45",
22-
"2.345e1",
23-
"1000",
24-
true,
25-
false);
26-
27-
for ($i = 0; $i < count($values); $i++) {
28-
$res = asin($values[$i]);
10+
foreach ($values as $value) {
11+
$res = asin($value);
2912
var_dump($res);
3013
}
3114

@@ -39,7 +22,3 @@ float(NAN)
3922
float(NAN)
4023
float(NAN)
4124
float(NAN)
42-
float(NAN)
43-
float(NAN)
44-
float(1.5707963267948966)
45-
float(0)
Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,24 @@
11
--TEST--
22
Test variations in usage of asinh()
33
--INI--
4-
serialize_precision = 10
4+
precision=14
55
--FILE--
66
<?php
7-
/*
8-
* Function is implemented in ext/standard/math.c
9-
*/
107

8+
$values = include 'data/numbers.inc';
119

12-
//Test asinh with a different input values
13-
14-
$values = array(23,
15-
-23,
16-
2.345e1,
17-
-2.345e1,
18-
0x17,
19-
027,
20-
"23",
21-
"23.45",
22-
"2.345e1",
23-
"1000",
24-
true,
25-
false);
26-
27-
for ($i = 0; $i < count($values); $i++) {
28-
$res = asinh($values[$i]);
10+
foreach ($values as $value) {
11+
$res = asinh($value);
2912
var_dump($res);
3013
}
3114

3215
?>
3316
--EXPECT--
34-
float(3.829113652)
35-
float(-3.829113652)
36-
float(3.848471992)
37-
float(-3.848471992)
38-
float(3.829113652)
39-
float(3.829113652)
40-
float(3.829113652)
41-
float(3.848471992)
42-
float(3.848471992)
43-
float(7.60090271)
44-
float(0.881373587)
45-
float(0)
17+
float(3.8291136516208812)
18+
float(-3.8291136516208812)
19+
float(3.8484719917851553)
20+
float(3.8484719917851553)
21+
float(-3.8484719917851553)
22+
float(2.99822295029797)
23+
float(3.027639279353268)
24+
float(8.97474462874175)

0 commit comments

Comments
 (0)