tests/testthat/test_replaceOutsideValues.R

testthat::context("Replacement of values below 0 or above 1")

testthat::test_that("Matrix with values above and below", {
  res1 <- replaceOutsideValues(matrix(c(2, 0.5, 0.4, 0.2, -1, -0.1), ncol = 2))

  testthat::expect_equal(as.numeric(res1[, 1]), c(1.0, 0.5, 0.4))
  testthat::expect_equal(as.numeric(res1[, 2]), c(0.2, 0.0, 0.0))
})

Try the BEclear package in your browser

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

BEclear documentation built on Nov. 8, 2020, 8:07 p.m.