tests/testthat/testmixGold.R

load("../../data/R4WSItasktest.rda")
load("../../data/goldR4WSItest.rda")

test_that("Test mixGold",{
  allR4WSItasktest <- mixGold(tasks = R4WSItasktest, golds = goldR4WSItest)

  expect_is(allR4WSItasktest, "data.frame")
  expect_is(allR4WSItasktest[,2], "character")
  expect_is(allR4WSItasktest[,3], "character")
  expect_is(allR4WSItasktest[,4], "character")
  expect_is(allR4WSItasktest[,5], "character")
  expect_is(allR4WSItasktest[,6], "character")
  expect_is(allR4WSItasktest[,7], "integer")
  expect_equal(length(allR4WSItasktest$id), length(unique(allR4WSItasktest$id)))
  expect_true(nchar(allR4WSItasktest[nrow(allR4WSItasktest),2]) > 1)
  expect_equal(sum(is.na(allR4WSItasktest)), 0)
  expect_equal(colnames(allR4WSItasktest)[1], "topic")
  expect_equal(colnames(allR4WSItasktest)[2], "doc")
  expect_equal(colnames(allR4WSItasktest)[3], "opt1")
  expect_equal(colnames(allR4WSItasktest)[4], "opt2")
  expect_equal(colnames(allR4WSItasktest)[5], "opt3")
  expect_equal(colnames(allR4WSItasktest)[6], "optcrt")
  expect_equal(colnames(allR4WSItasktest)[7], "id")
  expect_equal(length(unique(allR4WSItasktest[,1])), nrow(masstest[[1]])+1)
  expect_true(("gold" %in% unique(allR4WSItasktest[,1])))
})
Luwei-Ying/validateIt documentation built on May 12, 2021, 9:43 p.m.