tests/testthat/test_misc.R

context("misc")

test_that("bit vector", {

  #example logical index
  indx <- rep(F, 1e6)
  indx[sample.int(1e6, 1e5)] <- T
  
  #convert to bit vector
  bitVec <- toBitVec(indx)
  expect_is(bitVec, "raw")
  expect_equal(attr(bitVec, "bitlen"), 1e6)
  #convert it back
  indx1 <- toLogical(bitVec)
  expect_equal(indx, indx1)
})

Try the ncdfFlow package in your browser

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

ncdfFlow documentation built on Nov. 8, 2020, 7:52 p.m.