inst/tinytest/bc_general/test-bcapply-attr.R

# test binary attributes
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


op <- \(x, y) length(x) == length(y)
bc.fun <- \(x, y) bcapply(x, y, op)
types <- c("raw", "logical", "integer", "double", "complex", "character", "list")
res <- .test_binary_class(bc.fun, types, types)
expect_equal(
  res$expected_bc,
  res$out_bc
)
expect_equal(
  res$expected_comm,
  res$out_comm
)

enumerate <- enumerate + res$i

res <- .test_binary_zerolen(bc.fun, is.list, types, types)
expect_equal(
  res$expected_bc,
  res$out_bc
)
expect_equal(
  res$expected_comm,
  res$out_comm
)

enumerate <- enumerate + res$i

Try the broadcast package in your browser

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

broadcast documentation built on Aug. 20, 2026, 9:08 a.m.