tests/testthat/test-generate-c.R

context("generate: c (tools)")

test_that("Integer sums over arrays not supported", {
  data <- list(elements = list(y = list(storage_type = "int")))
  expect_error(
    generate_c_sexp(list("sum", "y", 1, 2), data, list(), character()),
    "Partial integer sums not yet supported")
  data$elements$y$storage_type <- "double"
  expect_equal(
    generate_c_sexp(list("sum", "y", 1, 2), data, list(), character()),
    "odin_sum1(y, 0, 2)")
})

Try the odin package in your browser

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

odin documentation built on April 28, 2022, 9:05 a.m.