Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Nov 28, 2024
1 parent 2b0a3da commit f2a33f4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions R/ind.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
#' @param x line to ignore
#' @return character vector representing ignored variables
#' @author Matthew L. Fidler
#' @noRd
.asCharacterIgnore <- function(x) {
if (length(x$ignore) == 0L) return(character(0))
vapply(x$ignore,
Expand Down
27 changes: 27 additions & 0 deletions tests/testthat/test-content.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Sex = {type=categorical, categories={M, F}}")
Sex = list(cat = c("M", "F"),
quote = c(FALSE, FALSE))),
reg = c("E0", "Emax"),
ignore = character(0),
nbdoses = 7L,
yname = c("1", "2"),
ynameQuote=c(TRUE, TRUE),
Expand Down Expand Up @@ -80,6 +81,7 @@ limit = {use=limit}")
Sex = list(cat = c("M", "F"),
quote = c(FALSE, FALSE))),
reg = c("E0", "Emax"),
ignore=character(0),
nbdoses = 10L,
yname = c("1", "2"),
ynameQuote=c(TRUE, TRUE),
Expand Down Expand Up @@ -181,4 +183,29 @@ Race = {type=categorical, categories={Caucasian, Black, Latin}}
Sex = {type=categorical, categories={M, F}}
FLAG = {use=ignoredline}")


tmp2 <- list(use1 = c(identifier = "ID", time = "TIME", eventidentifier = "EVID",
amount = "AMT", interdoseinterval = NA, censored = NA,
limit = NA, observationtype = "YTYPE", administration = "ADM",
steadystate = NA, observation = "DV", occasion = NA,
rate = NA, additionaldose = NA, missingdependentvariable = NA,
infusiontime = NA),
cont = c("WT", "CRCL"),
cat = list(Race = list(cat = c("Caucasian", "Black", "Latin"),
quote = c(FALSE, FALSE, FALSE)),
Sex = list(cat = c("M", "F"),
quote = c(FALSE, FALSE))),
reg = c("E0", "Emax"),
ignore = "FLAG",
nbdoses = 7L,
yname = c("1", "2"),
ynameQuote = c(TRUE, TRUE),
ytype = character(0),
ytypeQuote = logical(0),
name = c("y1", "y2"),
type = c("continuous", "event"))

class(tmp2) <- "monolix2rxContent"

expect_equal(tmp, tmp2)
})
2 changes: 2 additions & 0 deletions tests/testthat/test-ind.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sex = {type=categorical, categories={M, F}}")
Sex = list(cat = c("M", "F"),
quote = c(FALSE, FALSE))),
reg = "E0",
ignore = character(0),
file=character(0))
class(.tmp2) <- "monolix2rxInd"

Expand All @@ -34,6 +35,7 @@ SEX = {type=categorical, categories={Female, Male}}")
SEX = list(cat = c("Female", "Male"),
quote = c(FALSE, FALSE))),
reg = character(0),
ignore = character(0),
file=character(0))
class(.tmp2) <- "monolix2rxInd"
expect_equal(.tmp, .tmp2)
Expand Down

0 comments on commit f2a33f4

Please sign in to comment.