inst/tinytest/test-implies.R

#context "test-implies")

# test_that("Error handling", {
  expect_error(Implies(1:5 > 0, 1:4 > 0), "length")


# test_that("implies same as hutils", {

  library(data.table)
  library(hutils)
  DT <- CJ(x = c(TRUE,
                 NA,
                 FALSE),
           y = c(TRUE,
                 NA,
                 FALSE))
  DT[, hutils_orig := implies(x, y)]
  DT[, hutils_cpp := Implies(x, y)]
  expect_identical(DT$hutils_cpp, DT$hutils_orig)


# test_that("No NAs", {
  expect_true(Implies(FALSE, FALSE, anyNAx = FALSE, anyNAy = FALSE))

Try the hutilscpp package in your browser

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

hutilscpp documentation built on Oct. 11, 2023, 9:06 a.m.