tests/testthat/test-eval_hybrid.R

test_that("arith operators are recognized", {
  expect_is(eval_hybrid(iris, Sepal.Length + Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length - Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length * Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length / Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length %% Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length %/% Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length ^ Sepal.Width), "hybrid")

  expect_is(eval_hybrid(iris, Sepal.Length + Sepal.Width + Petal.Length), "hybrid")
})

test_that("compare operators are recognized", {
  expect_is(eval_hybrid(iris, Sepal.Length == Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length != Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length > Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length < Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length >= Sepal.Width), "hybrid")
  expect_is(eval_hybrid(iris, Sepal.Length <= Sepal.Width), "hybrid")
})
romainfrancois/hybrid documentation built on June 29, 2023, 5:43 a.m.