Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 23, 2025
1 parent 56b26ba commit e37486c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test-zero_crossings.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test_that("zero_crossings", {
x <- sin(seq(0, 4 * pi, length.out = 100))
out <- zero_crossings(x)
expect_equal(out, c(1, 25.74975, 50.5, 75.25025), tolerance = 1e-4)
out <- find_inversions(x)
expect_equal(out, c(12.87478, 37.62484, 62.37516, 87.12522), tolerance = 1e-4)
expect_true(is.na(zero_crossings(c(1, 2))))
excpect_error(zero_crossings(1), regex = "is not smaller")
})

0 comments on commit e37486c

Please sign in to comment.