tests/testthat/test_rt_mixture.R

context("Input and output of rt.mixture()")
library("t.mix")

test_that("Inputs are correctly checked", {
  expect_error(rt.mixture())
  expect_error(rt.mixture(NULL))
  expect_error(rt.mixture("a"))
  expect_error(rt.mixture(matrix()))
  expect_error(rt.mixture(-120))
  expect_error(rt.mixture(5, NULL))
  expect_error(rt.mixture(5, "a"))
  expect_error(rt.mixture(5, c(-1,0,0)))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), NULL))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), "a"))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(1)))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), NULL))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), "a"))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(-1,-1,-1)))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(1)))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), NULL))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), "a"))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), c(1)))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), c(-1,-1,-1)))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), c(10,10,10), NULL))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), c(10,10,10), "a"))
  expect_error(rt.mixture(5, c(0.4,0.1,0.5), c(2,3,4), c(2,2,2), c(10,10,10), -10))
})

test_that("Output has correct format", {
  expect_true(is.numeric(rt.mixture(5, c(0.4,0.6), c(3,4), c(2,2), c(10,10), T)))
})
sp2019-antibiotics/Team-Student documentation built on Nov. 5, 2019, 9:13 a.m.