Skip to content

Commit d227a94

Browse files
committed
Fix the test case and the test fails
Added boundary value test case. Also removed test cases that should not be returned early from early return tests
1 parent 7c900f0 commit d227a94

10 files changed

+18
-8
lines changed

ext/bcmath/tests/bcround_away_from_zero.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_AWAY_FROM_ZERO);
2727
[-1.9, 0] => -2
2828

2929
========== minus precision ==========
30+
[50, -2] => 100
31+
[-50, -2] => -100
3032
[1230, -1] => 1230
3133
[1235, -1] => 1240
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_ceiling.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_CEILING);
2727
[-1.9, 0] => -1
2828

2929
========== minus precision ==========
30+
[50, -2] => 100
31+
[-50, -2] => 0
3032
[1230, -1] => 1230
3133
[1235, -1] => 1240
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_early_return.phpt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@ $otherModes = [
1515
];
1616

1717
$early_return_cases = [
18-
['123', -3],
1918
['123', -4],
20-
['123.123456', -3],
2119
['123.123456', -4],
2220
['123', 1],
2321
['123.5', 1],
2422
['123.5', 2],
2523
['123.0000000000000000000001', 22],
2624
['123.0000000000000000000001', 23],
27-
['-123', -3],
2825
['-123', -4],
29-
['-123.123456', -3],
3026
['-123.123456', -4],
3127
['-123', 1],
3228
['-123.5', 1],
@@ -73,18 +69,14 @@ foreach ($otherModes as $mode) {
7369
}
7470
?>
7571
--EXPECT--
76-
[123, -3] => 0
7772
[123, -4] => 0
78-
[123.123456, -3] => 0
7973
[123.123456, -4] => 0
8074
[123, 1] => 123
8175
[123.5, 1] => 123.5
8276
[123.5, 2] => 123.5
8377
[123.0000000000000000000001, 22] => 123.0000000000000000000001
8478
[123.0000000000000000000001, 23] => 123.0000000000000000000001
85-
[-123, -3] => 0
8679
[-123, -4] => 0
87-
[-123.123456, -3] => 0
8880
[-123.123456, -4] => 0
8981
[-123, 1] => -123
9082
[-123.5, 1] => -123.5

ext/bcmath/tests/bcround_floor.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_FLOOR);
2727
[-1.9, 0] => -2
2828

2929
========== minus precision ==========
30+
[50, -2] => 0
31+
[-50, -2] => -100
3032
[1230, -1] => 1230
3133
[1235, -1] => 1230
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_half_down.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_HALF_DOWN);
2727
[-1.9, 0] => -2
2828

2929
========== minus precision ==========
30+
[50, -2] => 0
31+
[-50, -2] => 0
3032
[1230, -1] => 1230
3133
[1235, -1] => 1230
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_half_even.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_HALF_EVEN);
2727
[-1.9, 0] => -2
2828

2929
========== minus precision ==========
30+
[50, -2] => 0
31+
[-50, -2] => 0
3032
[1230, -1] => 1230
3133
[1235, -1] => 1240
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_half_odd.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_HALF_ODD);
2727
[-1.9, 0] => -2
2828

2929
========== minus precision ==========
30+
[50, -2] => 100
31+
[-50, -2] => -100
3032
[1230, -1] => 1230
3133
[1235, -1] => 1230
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_half_up.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_HALF_UP);
2727
[-1.9, 0] => -2
2828

2929
========== minus precision ==========
30+
[50, -2] => 100
31+
[-50, -2] => -100
3032
[1230, -1] => 1230
3133
[1235, -1] => 1240
3234
[-1230, -1] => -1230

ext/bcmath/tests/bcround_test_helper.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ function run_round_test(int $mode)
3030
];
3131

3232
$minus_precision_cases = [
33+
['50', -2],
34+
['-50', -2],
3335
['1230', -1],
3436
['1235', -1],
3537
['-1230', -1],

ext/bcmath/tests/bcround_toward_zero.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ run_round_test(PHP_ROUND_TOWARD_ZERO);
2727
[-1.9, 0] => -1
2828

2929
========== minus precision ==========
30+
[50, -2] => 0
31+
[-50, -2] => 0
3032
[1230, -1] => 1230
3133
[1235, -1] => 1230
3234
[-1230, -1] => -1230

0 commit comments

Comments
 (0)