tests/testthat/test-utils-invert_bijection.R

test_that("inverse_with_uniroot() works", {
  expect_equal(inverse_with_uniroot(f = function(x) {
    2 * x
  }, y = 0.5), 0.25)
})


test_that("vectorization inverse_with_uniroot_sorted() works", {
  expect_equal(inverse_with_uniroot_sorted(f = function(x) {
    2 * x
  }, y = c(0, 0.5)), c(0, 0.25))
})

### Add testst hat show how these functions break

Try the nhppp package in your browser

Any scripts or data that you put into this service are public.

nhppp documentation built on Oct. 30, 2024, 9:28 a.m.