tests/testthat/test-issue-4.R

rxodeTest(
  {
    context("Working Directory + Model Name (Issue #4)")

    model_text <- "
  C2 = centr/V2;
  C3 = peri/V3;
  d/dt(depot) =-KA*depot;
  d/dt(centr) = KA*depot - CL*C2 - Q*C2 + Q*C3;
  d/dt(peri)  =                    Q*C2 - Q*C3;
  d/dt(eff)  = Kin - Kout*(1-C2/(EC50+C2))*eff;
  "
    modName <- paste(sample(LETTERS, 5), collapse = "")
    model <- RxODE::RxODE(model = model_text, modName = modName, wd = "mytempdir")

    test_that("Model has the correct states", {
      expect_equal(
        rxState(model),
        c("depot", "centr", "peri", "eff")
      )
      expect_equal(
        rxParams(model),
        c("V2", "V3", "KA", "CL", "Q", "Kin", "Kout", "EC50")
      )
    })

    rxDelete(model)
    unlink("mytempdir", recursive = TRUE)
  },
  silent = TRUE,
  test = "lvl2"
)

Try the RxODE package in your browser

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

RxODE documentation built on March 23, 2022, 9:06 a.m.