tests/testthat/test-misclassification.R

set.seed(1234)

test_that("throw warning if missing values are found in pred or true", {
  a <- rbinom(5,1,0.5)
  a[1] <- NA
  b <- rbinom(5,1,0.5)
  expect_warning(misclassification(a,b))

  a <- rbinom(5,1,0.5)
  b <- rbinom(5,1,0.5)
  b[1] <- NA
  expect_warning(misclassification(a,b))
}
)

test_that("throw error if pred and true differ in length", {
  a <- rnorm(5,0,1)
  b <- rnorm(4,0,1)
  expect_error(misclassification(a,b))
}
)

Try the xtune package in your browser

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

xtune documentation built on July 9, 2023, 5:22 p.m.