Skip to content

Commit 32ec1cc

Browse files
committed
add value error case to tests
1 parent eec33df commit 32ec1cc

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

ext/bcmath/tests/bcceil.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ foreach ($nums as $num) {
2727
echo $num."\n";
2828
echo '=> '.bcceil($num)."\n\n";
2929
}
30+
31+
echo "========== value error ==========\n";
32+
try {
33+
bcceil('hoge');
34+
} catch (Throwable $e) {
35+
echo $e->getMessage()."\n";
36+
}
37+
38+
try {
39+
bcceil('0.00.1');
40+
} catch (Throwable $e) {
41+
echo $e->getMessage()."\n";
42+
}
3043
?>
3144
--EXPECT--
3245
0
@@ -76,3 +89,7 @@ foreach ($nums as $num) {
7689

7790
-100000.000000000000000000000000000000000000000001
7891
=> -100000
92+
93+
========== value error ==========
94+
bcceil(): Argument #1 ($num) is not well-formed
95+
bcceil(): Argument #1 ($num) is not well-formed

ext/bcmath/tests/bcfloor.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ foreach ($nums as $num) {
2727
echo $num."\n";
2828
echo '=> '.bcfloor($num)."\n\n";
2929
}
30+
31+
echo "========== value error ==========\n";
32+
try {
33+
bcfloor('hoge');
34+
} catch (Throwable $e) {
35+
echo $e->getMessage()."\n";
36+
}
37+
38+
try {
39+
bcfloor('0.00.1');
40+
} catch (Throwable $e) {
41+
echo $e->getMessage()."\n";
42+
}
3043
?>
3144
--EXPECT--
3245
0
@@ -76,3 +89,7 @@ foreach ($nums as $num) {
7689

7790
-100000.000000000000000000000000000000000000000001
7891
=> -100001
92+
93+
========== value error ==========
94+
bcfloor(): Argument #1 ($num) is not well-formed
95+
bcfloor(): Argument #1 ($num) is not well-formed

ext/bcmath/tests/bcround.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,19 @@ foreach ($modes as $mode) {
170170
}
171171
echo "\n";
172172
}
173+
174+
echo "========== value error ==========\n";
175+
try {
176+
bcround('hoge');
177+
} catch (Throwable $e) {
178+
echo $e->getMessage()."\n";
179+
}
180+
181+
try {
182+
bcround('0.00.1');
183+
} catch (Throwable $e) {
184+
echo $e->getMessage()."\n";
185+
}
173186
?>
174187
--EXPECT--
175188
========== early return ==========
@@ -825,3 +838,7 @@ foreach ($modes as $mode) {
825838
[-0.0005, 3] => -0.001
826839
[-0.000500, 3] => -0.001
827840
[-0.000501, 3] => -0.001
841+
842+
========== value error ==========
843+
bcround(): Argument #1 ($num) is not well-formed
844+
bcround(): Argument #1 ($num) is not well-formed

0 commit comments

Comments
 (0)