inst/tinytest/bc_bytes/test-bc_bit_negate.R

# set-up ====
enumerate <- 0L
errorfun <- function(tt) {
  
  if(isFALSE(tt)) stop(print(tt))
}
.test_binary <- broadcast:::.test_binary
.test_binary_class <- broadcast:::.test_binary_class
.test_binary_zerolen <- broadcast:::.test_binary_zerolen

# bit-wise negation for raw ====
x <- as.raw(sample(0:255))
expect_equal(
  !x,
  bc.bit(x, x, "nand")
)
x <- as.raw(sample(0:255))
expect_equal(
  !x,
  bc.bit(x, x, "nor")
)


# bit-wise negation for integer ====
x <- sample(c(-100:100, NA))
expect_equal(
  bitwNot(x),
  bc.bit(x, x, "nand")
)
x <- sample(c(-100:100, NA))
expect_equal(
  bitwNot(x),
  bc.bit(x, x, "nor")
)


enumerate <- enumerate + 4L

Try the broadcast package in your browser

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

broadcast documentation built on Oct. 4, 2026, 5:07 p.m.