tests/testthat/test-mem-npde-empty.R

nmTest({
  test_that("npdeCalc with zero-row input errors gracefully (no crash)", {
    # empty input previously caused a SIGSEGV reading id[0]/simId[0]
    empty_npdesim <- list(
      simId = integer(0), id = integer(0), ipred = numeric(0),
      pred = numeric(0), lambda = numeric(0), yj = numeric(0),
      low = numeric(0), hi = numeric(0)
    )
    expect_error(
      .Call("_nlmixr2est_npdeCalc", empty_npdesim, numeric(0),
            NULL, NULL, NULL, list(), PACKAGE = "nlmixr2est"),
      "zero rows"
    )
  })
})

Try the nlmixr2est package in your browser

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

nlmixr2est documentation built on Aug. 5, 2026, 1:11 a.m.