tests/testthat/test_reduction.R

context("Vector reduction")
library(dst)
test_that("reduction", {
  # T1 Apply reduction to a numeric vector
  result <- reduction(c(1,2,3,4), f="-")
  expect_equal(result, -8)
  # T2 Apply reduction to a logical vector
  result <-  reduction(c(1,0,1,1,0), f="&")
  expect_equal(result, FALSE)
  #T3 Apply reduction to a string vector
  result <- reduction(c("a", "b", "c"), f="paste")
  expect_equal(result, "a b c")
})
RAPLER/dst-1 documentation built on June 2, 2025, 9:22 a.m.