tests/testthat/test_CCKriging.R

context("CCKriging Class")

test_that("objects of class CCKriging are constructed correctly", {
  x = data.frame(a = 1:2, b = c("a", "b"))
  y = 1:2
  cc = makeCCKriging(x = x, y = y, cat.type = "TMC")
  expect_is(cc, "CCKriging")
  expect_null(cc$par)
  expect_error(makeCCKriging(x = 1, y = 1, cat.type = "EC"))  # x must be a data.frame
  expect_error(makeCCKriging(x = x, y = y, cat.type = "EC", par = 1:4))  # par too long
  expect_error(makeCCKriging(x = x, y = y, cat.type = "UC", par = 1))  # par too short
  expect_error(makeCCKriging(x = x, y = y, cat.type = "InvalidType", par = 1))  # invalid cat.type

  x = data.frame(x, c = c("not a", "factor"))
  x$c = as.character(x$c)
  expect_error(makeCCKriging(x = x, y = y, cat.type = "EC"), "numeric vector or a factor")
})
dominikkirchhoff/CCKriging documentation built on May 19, 2019, 4:05 p.m.