tests/testthat/test-utils_check.R

context("Checking functions")

test_that(
"Test class testing functions", {
    expect_true(is_one_of(1, c("numeric", "character")))
    expect_true(is_one_of("A", c("numeric", "character")))
    expect_false(is_one_of(TRUE, c("numeric", "character")))
    expect_false(is_one_of("A", c("numeric", "logical")))
    expect_error(is_one_of(1, 1))

    x <- 0
    class(x) <- c("foo", "numeric")
    expect_true(is_all_of(x, c("foo", "numeric")))
    expect_true(is_all_of(x, c("numeric", "foo")))
    expect_false(is_all_of(x, c("foo", "numeric", "bar")))
    expect_error(is_all_of(1, 1))
})

Try the CellBench package in your browser

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

CellBench documentation built on Nov. 8, 2020, 5:11 p.m.