Skip to content

Commit f7420e4

Browse files
committed
fix couple of tests, explicitly check for overflow errors
1 parent 7bcb01b commit f7420e4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

inst/tinytest/test_sugar.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ suppressWarnings(RNGversion("3.5.0"))
3333

3434
# test.sugar.safe_math
3535
expect_equal(safe_add(3, 2), 5)
36-
expect_error(safe_add(.Machine$integer.max, 2))
36+
expect_error(safe_add(.Machine$integer.max, 2), "overflow")
3737
expect_equal(safe_sub(3, 2), 1)
38-
expect_error(safe_sub(.Machine$integer.min, 2))
38+
expect_error(safe_sub(-.Machine$integer.max, 2), "overflow")
3939
expect_equal(safe_mul(3, 2), 6)
40-
expect_error(safe_mul(.Machine$integer.max, 2))
40+
expect_error(safe_mul(.Machine$integer.max, 2), "overflow")
4141

4242
expect_equal(safe_add_fallback(3, 2), 5)
43-
expect_error(safe_add_fallback(.Machine$integer.max, 2))
43+
expect_error(safe_add_fallback(.Machine$integer.max, 2), "overflow")
4444
expect_equal(safe_sub_fallback(3, 2), 1)
45-
expect_error(safe_sub_fallback(.Machine$integer.min, 2))
45+
expect_error(safe_sub_fallback(-.Machine$integer.max, 2), "overflow")
4646
expect_equal(safe_mul_fallback(3, 2), 6)
47-
expect_error(safe_mul_fallback(.Machine$integer.max, 2))
47+
expect_error(safe_mul_fallback(.Machine$integer.max, 2), "overflow")
4848

4949

5050
# test.sugar.abs <- function( ){

0 commit comments

Comments
 (0)