tests/testthat/test-base.R

test_that("base R atomic", {
  expect_true(is.atomic(1))
  expect_true(is.atomic(matrix(1)))
  expect_true(is.atomic(array(1)))

  expect_false(is.atomic(list()))
})

test_that("base R numeric", {
  expect_true(is.numeric(1))
  expect_true(is.numeric(matrix(1)))
  expect_true(is.numeric(array(1)))

  expect_true(is.numeric(1L))
  expect_true(is.numeric(matrix(1L)))
  expect_true(is.numeric(array(1L)))

  expect_false(is.numeric(TRUE))
  expect_false(is.numeric(matrix(TRUE)))
  expect_false(is.numeric(array(TRUE)))
})

Try the nlist package in your browser

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

nlist documentation built on Sept. 5, 2021, 6:05 p.m.