Skip to content

Commit

Permalink
splitting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philipdelff committed Jan 17, 2025
1 parent 3c2b7ca commit c1664d9
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 6 deletions.
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
`$DATA` and `$INPUT` sections based on a data set. Previously a data
object had to be passed to the function. Now also just a path to the
data set on file can be used.


## Bugfixes
* `NMreadExt()` was incorrectly calculating blocksize for some
OMEGAs. Thanks to Brian Reilly for proposing a bugfix!

* `mat2dt()` was doing the opposite to what was specified by the
`triangle` argument and returned the upper triangle when
`triangle=lower` and vice versa.
Expand All @@ -39,7 +43,7 @@
* `dt2mat()` would only work on `data.table`s. Support for other
`data.frame`s added.

## Other improvements
## Other minor improvements
* `addTAPD()` has a few improvements on documentations and the following
improvements on code. Together they imply that `by` defaults to
`NMdataConf()$col.id`.
Expand All @@ -51,6 +55,10 @@
* `NMcheckData()` did not check for missing (NA) values on dose
events. Checks now capture this.

* `NMgenText()` now looks up `col.flagn` using `NMdataConf()` for
default value.


# NMdata 0.1.8

## New features
Expand Down
2 changes: 1 addition & 1 deletion R/NMreadInits.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,5 +446,5 @@ initsToExt <- function(elements){
pars <- pars[,.(par.type,parameter,par.name,i,j,iblock,blocksize,init,lower,upper,FIX)]
pars <- pars[order(match(par.type,c("THETA","OMEGA","SIGMA")),i,j)]

pars
pars[]
}
Binary file not shown.
Binary file not shown.
Binary file added tests/testthat/testReference/NMreadInits_01_pars.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tests/testthat/testReference/NMreadInits_02_pars.rds
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added tests/testthat/testReference/NMreadInits_03_pars.rds
Binary file not shown.
19 changes: 15 additions & 4 deletions tests/testthat/test_NMreadInits.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ test_that("basic",{
lines <- readLines(file.mod)
res1 <- NMreadInits(lines=lines,return="all")

## res1$lines[grepl("^ +$",text.before),text.before:=""]
res1$lines[grepl("^ +$",text.before),text.before:=""]

## cat(paste(res1$lines$text.before,collapse=":"),"\n")
## cat(paste(readRDS(fileRef)$lines$text.before,collapse=":"),"\n")

expect_equal_to_reference(res1,fileRef)
## expect_equal_to_reference(res1,fileRef)
expect_equal_to_reference(res1$pars,fnAppend(fileRef,"pars"))
expect_equal_to_reference(res1$elements,fnAppend(fileRef,"elems"))
expect_equal_to_reference(res1$lines,fnAppend(fileRef,"lines"))


})
Expand All @@ -29,7 +32,10 @@ test_that("with OMEGA block",{
file.mod <- "testData/nonmem/xgxr133.mod"
res1 <- NMreadInits(file=file.mod,return="all")

expect_equal_to_reference(res1,fileRef)
## expect_equal_to_reference(res1,fileRef)
expect_equal_to_reference(res1$pars,fnAppend(fileRef,"pars"))
expect_equal_to_reference(res1$elements,fnAppend(fileRef,"elems"))
expect_equal_to_reference(res1$lines,fnAppend(fileRef,"lines"))

})

Expand All @@ -49,5 +55,10 @@ $OMEGA BLOCK(1) SAME")

res1 <- NMreadInits(lines=text,return="all")

expect_equal_to_reference(res1,fileRef)
## expect_equal_to_reference(res1,fileRef)
expect_equal_to_reference(res1$pars,fnAppend(fileRef,"pars"))
expect_equal_to_reference(res1$elements,fnAppend(fileRef,"elems"))
expect_equal_to_reference(res1$lines,fnAppend(fileRef,"lines"))


})

0 comments on commit c1664d9

Please sign in to comment.