tests/testthat/test-thresholdfunctions.R

context("test-thresholdfunctions")

test_that("soft-thresholding works", {
  expect_equal(soft(3, 1), 2)
  expect_equal(soft(-3, 1), -2)
  expect_equal(soft(-1, 2), 0)
})

test_that("hard-thresholding works", {
  expect_equal(hard(3, 1), 3)
  expect_equal(hard(-3, 1), -3)
  expect_equal(hard(-1, 2), 0)
})
kristynpantoja/TestPackage documentation built on May 28, 2019, 6:33 p.m.