tests/testthat/test-utils-has_length.R

test_that("true-vector_integers", {
  expect_true(has_length(0:0))
  expect_true(has_length(0:1))
  expect_true(has_length(0:2))
  expect_true(has_length(0:3))
})
test_that("true-vector_characters", {
  expect_true(has_length(LETTERS[1:1]))
  expect_true(has_length(LETTERS[1:2]))
  expect_true(has_length(LETTERS[1:3]))
  expect_true(has_length(LETTERS[1:4]))
})
test_that("true-objects-dataframes", {
  expect_true(has_length(data.frame(character = LETTERS[1:4])))
  expect_true(has_length(data.frame(integer = 1:4)))
  expect_true(has_length(data.frame(character = LETTERS[1:4], integer = 1:4)))
})
test_that("true-specials", {
  expect_true(has_length(FALSE))
  expect_true(has_length(TRUE))
  expect_true(has_length(as.double(NA)))
  expect_true(has_length(as.integer(NA)))
  expect_true(has_length(as.character(NA)))
})
test_that("false-specials", {
  expect_false(has_length(NULL))
  expect_false(has_length(character(0)))
  expect_false(has_length(numeric(0)))
  expect_false(has_length(integer(0)))
})
maxjnorman/shiny.table.store documentation built on March 20, 2024, 3:15 p.m.