From 30cbb4092f6d2d3beff5800603374a0d009ad770 Mon Sep 17 00:00:00 2001 From: jranke Date: Tue, 11 May 2010 23:03:37 +0000 Subject: Initial upload of the upcoming multicompartment version of kinfit. Some functionality is still missing (chi2), some may never be implemented (FOMC model), but in general it is much more powerful than kinfit, owing to the powerful FME package. git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@8 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- inst/unitTests/Makefile | 15 ++++++++++++ inst/unitTests/runit.mkinmod.R | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 inst/unitTests/Makefile create mode 100644 inst/unitTests/runit.mkinmod.R (limited to 'inst/unitTests') diff --git a/inst/unitTests/Makefile b/inst/unitTests/Makefile new file mode 100644 index 00000000..8d132253 --- /dev/null +++ b/inst/unitTests/Makefile @@ -0,0 +1,15 @@ +TOP=../.. +PKG=${shell cd ${TOP};pwd} +SUITE=doRUnit.R +R=R + +all: inst test + +inst: # Install package + cd ${TOP}/..;\ + ${R} CMD INSTALL ${PKG} + +test: # Run unit tests + export RCMDCHECK=FALSE;\ + cd ${TOP}/tests;\ + ${R} --vanilla --slave < ${SUITE} diff --git a/inst/unitTests/runit.mkinmod.R b/inst/unitTests/runit.mkinmod.R new file mode 100644 index 00000000..b6ca6b8d --- /dev/null +++ b/inst/unitTests/runit.mkinmod.R @@ -0,0 +1,53 @@ +test.mkinmod.SFO <- function() +{ + SFO.diffs <- c( + parent = "d_parent = - k_parent_sink * parent" + ) + SFO.parms <- c("k_parent_sink") + SFO.map <- list(parent = "parent") + SFO <- list(diffs = SFO.diffs, parms = SFO.parms, map = SFO.map) + class(SFO) <- "mkinmod" + SFO.mkinmod <- mkinmod(spec = list( + parent = list(type = "SFO", to = NA, sink=TRUE)) + ) + checkIdentical(SFO, SFO.mkinmod) +} + +test.mkinmod.SFORB <- function() +{ + SFORB.diffs <- c( + parent_free = paste( + "d_parent_free = - k_parent_free_sink * parent_free", + "- k_parent_free_bound * parent_free", + "+ k_parent_bound_free * parent_bound"), + parent_bound = paste( + "d_parent_bound =", + "+ k_parent_free_bound * parent_free", + "- k_parent_bound_free * parent_bound") + ) + SFORB.parms <- c("k_parent_free_sink", "k_parent_free_bound", "k_parent_bound_free") + SFORB.map <- list(parent = c("parent_free", "parent_bound")) + SFORB <- list(diffs = SFORB.diffs, parms = SFORB.parms, map = SFORB.map) + class(SFORB) <- "mkinmod" + SFORB.mkinmod <- mkinmod(spec = list( + parent = list(type = "SFORB", to = NA, sink=TRUE)) + ) + checkIdentical(SFORB, SFORB.mkinmod) +} + +test.mkinmod.SFO_SFO <- function() +{ + SFO_SFO.diffs <- c( + parent = "d_parent = - k_parent_sink * parent - k_parent_m1 * parent", + m1 = "d_m1 = - k_m1_sink * m1 + k_parent_m1 * parent" + ) + SFO_SFO.parms <- c("k_parent_sink", "k_m1_sink", "k_parent_m1") + SFO_SFO.map <- list(parent = "parent", m1 = "m1") + SFO_SFO <- list(diffs = SFO_SFO.diffs, parms = SFO_SFO.parms, map = SFO_SFO.map) + class(SFO_SFO) <- "mkinmod" + SFO_SFO.mkinmod <- mkinmod(spec = list( + parent = list(type = "SFO", to = "m1", sink=TRUE), + m1 = list(type = "SFO", to = NA, sink=TRUE)) + ) + checkIdentical(SFO_SFO, SFO_SFO.mkinmod) +} -- cgit v1.2.1