diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index c716381b1..d0823ccb0 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -1,83 +1,83 @@ rxTest({ - - expect_plotlog <- function(o, timex, logx, logy, dat) { - # Checking for the correct type for logx and logy is nontrivial, so j - expect_named(o, c("timex", "logx", "logy", "dat")) - if (is.null(timex)) { - expect_null(o$timex) - } else { - expect_equal(o$timex, timex) - } - if (is.null(logx)) { - expect_null(o$logx) - } else { - expect_type(o$logx, "list") - expect_length(o$logx, 1) - expect_s3_class(o$logx[[1]], logx) - } - if (is.null(logy)) { - expect_null(o$logy) - } else { - expect_type(o$logy, "list") - expect_length(o$logy, 1) - expect_s3_class(o$logy[[1]], logy) - } - expect_equal(o$dat, dat) - } - test_that(".plotLog works without xgxr", { - skip_on_os("mac") - d <- data.frame(time=-1:2, conc=0:3) - expect_equal( - .plotLog(.dat=d, .timex="A", log=""), - list( - timex="A", - logx=NULL, - logy=NULL, - dat=d - ) - ) - expect_plotlog( - .plotLog(.dat=d, .timex="A", log="x"), - timex=NULL, logx="ScaleContinuousPosition", logy=NULL, dat=d[-(1:2), ] - ) - expect_plotlog( - .plotLog(.dat=d, .timex="A", log="y"), - timex="A", logx=NULL, logy="ScaleContinuousPosition", dat=d - ) - expect_plotlog( - .plotLog(.dat=d, .timex="A", log="xy"), - timex=NULL, logx="ScaleContinuousPosition", logy="ScaleContinuousPosition", dat=d[-(1:2), ] - ) - }) + ## expect_plotlog <- function(o, timex, logx, logy, dat) { + ## # Checking for the correct type for logx and logy is nontrivial, so j + ## expect_named(o, c("timex", "logx", "logy", "dat")) + ## if (is.null(timex)) { + ## expect_null(o$timex) + ## } else { + ## expect_equal(o$timex, timex) + ## } + ## if (is.null(logx)) { + ## expect_null(o$logx) + ## } else { + ## expect_type(o$logx, "list") + ## expect_length(o$logx, 1) + ## expect_s3_class(o$logx[[1]], logx) + ## } + ## if (is.null(logy)) { + ## expect_null(o$logy) + ## } else { + ## expect_type(o$logy, "list") + ## expect_length(o$logy, 1) + ## expect_s3_class(o$logy[[1]], logy) + ## } + ## expect_equal(o$dat, dat) + ## } - test_that(".plotLog works with xgxr", { - skip_if_not_installed("xgxr") - skip_on_os("mac") - skip("See https://github.com/Novartis/xgxr/issues/50 for why xgxr is not uniquely tested as of 2022-03-15") - current_xgxr_option <- getOption("rxode2.xgxr") - withr::with_options( - list(rxode2.xgxr=TRUE), { - d <- data.frame(time=-1:2, conc=0:3) - # Insert tests here - } - ) - }) + ## test_that(".plotLog works without xgxr", { + ## skip_on_os("mac") + ## d <- data.frame(time=-1:2, conc=0:3) + ## expect_equal( + ## .plotLog(.dat=d, .timex="A", log=""), + ## list( + ## timex="A", + ## logx=NULL, + ## logy=NULL, + ## dat=d + ## ) + ## ) + ## expect_plotlog( + ## .plotLog(.dat=d, .timex="A", log="x"), + ## timex=NULL, logx="ScaleContinuousPosition", logy=NULL, dat=d[-(1:2), ] + ## ) + ## expect_plotlog( + ## .plotLog(.dat=d, .timex="A", log="y"), + ## timex="A", logx=NULL, logy="ScaleContinuousPosition", dat=d + ## ) + ## expect_plotlog( + ## .plotLog(.dat=d, .timex="A", log="xy"), + ## timex=NULL, logx="ScaleContinuousPosition", logy="ScaleContinuousPosition", dat=d[-(1:2), ] + ## ) + ## }) - test_that(".plotLog gives expected errors", { - skip_on_os("mac") - expect_error(.plotLog(log=c("x", "y"))) - expect_error(.plotLog(log=1)) - expect_error(.plotLog(log="foo")) - expect_error(.plotLog(log=c("x", "y"))) - expect_error(.plotLog(.dat=data.frame(A=1), log="x", .timex="A")) - # Time column is only required when log="x" - expect_silent(.plotLog(.dat=data.frame(A=1), log="y", .timex="A")) - }) + ## test_that(".plotLog works with xgxr", { + ## skip_if_not_installed("xgxr") + ## skip_on_os("mac") + ## skip("See https://github.com/Novartis/xgxr/issues/50 for why xgxr is not uniquely tested as of 2022-03-15") + ## current_xgxr_option <- getOption("rxode2.xgxr") + ## withr::with_options( + ## list(rxode2.xgxr=TRUE), { + ## d <- data.frame(time=-1:2, conc=0:3) + ## # Insert tests here + ## } + ## ) + ## }) + + ## test_that(".plotLog gives expected errors", { + ## skip_on_os("mac") + ## expect_error(.plotLog(log=c("x", "y"))) + ## expect_error(.plotLog(log=1)) + ## expect_error(.plotLog(log="foo")) + ## expect_error(.plotLog(log=c("x", "y"))) + ## expect_error(.plotLog(.dat=data.frame(A=1), log="x", .timex="A")) + ## # Time column is only required when log="x" + ## expect_silent(.plotLog(.dat=data.frame(A=1), log="y", .timex="A")) + ## }) test_that("plot() with invalid component throws an error", { skip_on_os("mac") - + pheno2 <- function() { ini({ tcl <- log(0.008) @@ -104,5 +104,5 @@ rxTest({ expect_warning(plot(sim, sim, "foo")) expect_error(plot(sim), NA) }) - + })