tests/testthat/test-notin.R

# ---------------------------------------------------------------------------- #
test_that("Infix operator %notin% works for lhs with fewer elements than rhs", {
  x <- c(1, 3)
  y <- c(2, 3, 4)
  expect_equal(x %notin% y, c(TRUE, FALSE))
})

# ---------------------------------------------------------------------------- #
test_that("Infix operator %notin% works for rhs with fewer elements than lhs", {
  x <- c(2, 3, 4)
  y <- c(1, 3)
  expect_equal(x %notin% y, c(TRUE, FALSE, TRUE))
})

# ---------------------------------------------------------------------------- #
test_that("Infix operator %notin% works for strings", {
  x <- c("fox", "wolf", "dog")
  y <- c("the", "quick", "brown", "fox", "is", "not", "a", "dog")
  expect_equal(x %notin% y, c(FALSE, TRUE, FALSE))
})

# ---------------------------------------------------------------------------- #
toniprice/jute documentation built on Jan. 11, 2023, 8:23 a.m.