-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#265) * Fixes #253 default expand for ddi ratio and other plot configurations * Also test default scales (lin/log/discrete)
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
context("Default values for plot configuration expand and scales") | ||
|
||
# To prevent copy/paste, expressions are used in the sequel | ||
plotNames <- c("DDIRatio", "", "TimeProfile", "ObsVsPred", "ResVsPred", "Histogram", "PKRatio", "BoxWhisker", "Tornado") | ||
|
||
# Epression is "<plotname>plotConfiguration <- <PlotName>PlotConfiguration$new()" | ||
createPlotConfigurations <- parse(text = paste0(tolower(plotNames), "plotConfiguration <- ", plotNames, "PlotConfiguration$new()")) | ||
eval(createPlotConfigurations) | ||
|
||
# Epression is "expect_false(<plotname>plotConfiguration$defaultExpand)" | ||
# Use -1 to remove first element ie DDI Ratio from the evaluation | ||
checkExpandIsFalse <- parse(text = paste0("expect_false(", tolower(plotNames[-1]), "plotConfiguration$defaultExpand)")) | ||
|
||
test_that("Default expand is true for DDI ratio only", { | ||
eval(checkExpandIsFalse) | ||
expect_true(ddiratioplotConfiguration$defaultExpand) | ||
}) | ||
|
||
|
||
test_that("Default x and y scales is log for ddi ratio", { | ||
expect_equal(ddiratioplotConfiguration$defaultXScale, Scaling$log) | ||
expect_equal(ddiratioplotConfiguration$defaultYScale, Scaling$log) | ||
}) | ||
|
||
test_that("Default x scale is linear and y scale is log for pk ratio", { | ||
expect_equal(pkratioplotConfiguration$defaultXScale, Scaling$lin) | ||
expect_equal(pkratioplotConfiguration$defaultYScale, Scaling$log) | ||
}) | ||
|
||
test_that("Default x scale is linear and y scale is discrete for tornado plot", { | ||
expect_equal(tornadoplotConfiguration$defaultXScale, Scaling$lin) | ||
expect_equal(tornadoplotConfiguration$defaultYScale, Scaling$discrete) | ||
}) | ||
|
||
test_that("Default x scale is discrete and y scale is linear for box-whisker plot", { | ||
expect_equal(boxwhiskerplotConfiguration$defaultXScale, Scaling$discrete) | ||
expect_equal(boxwhiskerplotConfiguration$defaultYScale, Scaling$lin) | ||
}) | ||
|
||
checkXScaleIsLinear <- parse(text = paste0("expect_equal(", tolower(plotNames[2:6]), "plotConfiguration$defaultXScale, Scaling$lin)")) | ||
checkYScaleIsLinear <- parse(text = paste0("expect_equal(", tolower(plotNames[2:6]), "plotConfiguration$defaultYScale, Scaling$lin)")) | ||
test_that("Default scales are linear for other plots", { | ||
eval(checkXScaleIsLinear) | ||
eval(checkYScaleIsLinear) | ||
}) |