tests/testthat/test-helper.R

test_that("logSumExpTrick", {
  x <- 3
  expect_equal(logSumExpTrick(x), x)
  
  xs <- c(-1, 2, 0)
  expect_equal(logSumExpTrick(xs), log(sum(exp(xs))))
  
  expect_error(logSumExpTrick())
})

Try the stcpR6 package in your browser

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

stcpR6 documentation built on Oct. 8, 2024, 9:07 a.m.