Skip to content

Commit f091894

Browse files
committed
Refactor tests a bit
1 parent 2da71bf commit f091894

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tests/testthat/_snaps/expect-comparison.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88
`x` is not strictly greater than 1.1 * x.
99
0.0000100 - 0.0000110 = -0.0000010 <= 0
1010

11-
---
11+
# useful output when difference is zero
1212

13-
`x` is not strictly less than `x`.
13+
`x` is not strictly less than 100.
1414
100.0 - 100.0 = 0.0 >= 0
1515

16+
# useful output when differnce is large
17+
18+
`x` is not strictly less than 0.001.
19+
100.000 - 0.001 = 99.999 >= 0
20+

tests/testthat/test-expect-comparison.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ test_that("useful output when numbers are very small", {
1212
x <- 1e-5
1313
expect_snapshot_failure(expect_lte(1.1 * x, x))
1414
expect_snapshot_failure(expect_gt(x, 1.1 * x))
15+
})
16+
17+
test_that("useful output when difference is zero", {
18+
x <- 100
19+
expect_snapshot_failure(expect_lt(x, 100))
20+
})
1521

22+
test_that("useful output when differnce is large", {
1623
x <- 100
17-
expect_snapshot_failure(expect_lt(x, x))
24+
expect_snapshot_failure(expect_lt(x, 0.001))
1825
})
1926

2027
test_that("comparison result object invisibly", {

0 commit comments

Comments
 (0)