tests/testthat/test_summariseR.R

#-------------------------------------------------------------------------------
# SUMMARISER
#-------------------------------------------------------------------------------

test_that("summariseR", {
  # Test case 1: Valid input
  test1 <- c(rep(1, 305), rep(0, 95), rep(1, 50), rep(0, 150))
  gold <- c(rep(1, 400), rep(0, 200))

  df <- data.frame(test1, gold)
  expect_no_error(summariseR(df))

  # Test case 2: Invalid input
  test1 <- c(rep(1, 305), rep(0, 95), rep(1, 50), rep(0, 150))
  test2 <- c(rep(1, 303), rep(0, 97), rep(1, 60), rep(0, 140))
  gold <- c(rep(1, 400), rep(0, 200))

  df <- data.frame(test1, test2, gold)
  expect_error(summariseR(df))
})

Try the testCompareR package in your browser

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

testCompareR documentation built on April 4, 2025, 2:35 a.m.