Skip to content

Commit

Permalink
Test for common=FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 2, 2023
1 parent ae2dc6d commit 913a576
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/testthat/test-ui-mod-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -754,4 +754,48 @@ rxTest({
expect_error(rxAppendModel(ocmt %>% model(ceff=cp,append=TRUE), idr))

})

test_that("combine models without anything in common", {

ocmt <- function() {
ini({
tka <- exp(0.45)
tcl <- exp(1)
tv <- exp(3.45)
add.sd <- 0.7
})
model({
ka <- tka
cl <- tcl
v <- tv
d/dt(depot) = -ka * depot
d/dt(center) = ka * depot - cl / v * center
cp = center / v
cp ~ add(add.sd)
})
}

idr <- function() {
ini({
tkin <- log(1)
tkout <- log(1)
tic50 <- log(10)
gamma <- fix(1)
idr.sd <- 1
})
model({
kin <- exp(tkin)
kout <- exp(tkout)
ic50 <- exp(tic50)
d/dt(eff) <- kin - kout*(1-ceff^gamma/(ic50^gamma+ceff^gamma))
eff ~ add(idr.sd)
})
}

m1 <- rxAppendModel(ocmt, idr, common=FALSE)

expect_true("idr.sd" %in% m1$iniDf$name)
expect_true("tv" %in% m1$iniDf$name)

})
})

0 comments on commit 913a576

Please sign in to comment.