Skip to content

Commit

Permalink
Merge pull request #306 from billdenney/helper-generate_data.R
Browse files Browse the repository at this point in the history
Switch generate.data.R to be a helper file, using the testthat infrastructure to include the functions
  • Loading branch information
billdenney authored Jun 28, 2024
2 parents 67e1be4 + e6fe38b commit 027ee95
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 22 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions tests/testthat/test-as_various.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("as_PKNCA*", {
tmpconc <- generate.conc(2, 1, 0:24)
tmpdose <- generate.dose(tmpconc)
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-class-PKNCAconc.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("PKNCAconc expected errors", {
tmp.conc <- generate.conc(nsub=1, ntreat=1, time.points=0:24)
tmp.conc$foo <- "A"
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-class-PKNCAdata.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("PKNCAdata", {
tmp.conc <- generate.conc(nsub=5, ntreat=2, time.points=0:24)
tmp.conc.analyte <- generate.conc(nsub=5, ntreat=2, time.points=0:24,
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-class-PKNCAdose.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("PKNCAdose", {
tmp.conc <- generate.conc(nsub=5, ntreat=2, time.points=0:24)
tmp.conc.analyte <- generate.conc(nsub=5, ntreat=2, time.points=0:24,
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-class-PKNCAresults.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("PKNCAresults object creation", {
minimal_result <- PKNCAresults(data.frame(a=1), data=list())
expect_equal(minimal_result$columns$exclude, "exclude")
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-dplyr.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

# based on purrr:::capture_output
msg_grabber <- function(code) {
messages <- character()
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-exclude.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("setExcludeColumn", {
# exclude argument not given
expect_equal(
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-impute.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("PKNCA_impute_method_start_conc0", {
# Time 0 is replaced
expect_equal(
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-pk.calc.all.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

test_that("pk.nca", {
# Note that generate.conc sets the random seed, so it doesn't have to happen
# here.
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-pk.calc.dn.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ test_that("pk.calc.dn", {

test_that("pk.calc.cmax", {
# Ensure that the formalsmap functionality works within pk.nca
source("generate.data.R")
tmpconc <- generate.conc(2, 2, 0:24)
tmpdose <- generate.dose(tmpconc)
tmpconc <- merge(tmpconc, tmpdose[,c("ID", "treatment", "dose")])
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-prepare_data.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
source("generate.data.R")

# prepare_* ####

test_that("prepare_*", {
Expand Down
2 changes: 1 addition & 1 deletion vignettes/v03-selection-of-calculation-intervals.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ library(cowplot)
library(PKNCA)
library(knitr)
library(ggplot2)
source("../tests/testthat/generate.data.R")
source("../tests/testthat/helper-generate_data.R")
scale_colour_discrete <- scale_colour_hue
scale_fill_discrete <- scale_fill_hue
```
Expand Down

0 comments on commit 027ee95

Please sign in to comment.