Skip to content

Commit

Permalink
Addressing Issue #1 (using vdiffr instead of checking against interna…
Browse files Browse the repository at this point in the history
…l structure).
  • Loading branch information
haiderstats committed May 23, 2019
1 parent 493c56a commit 0e9ee90
Show file tree
Hide file tree
Showing 14 changed files with 595 additions and 6 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Suggests:
ggplot2 (>= 3.0.0),
reshape2 (>= 1.4.3),
testthat,
vdiffr (>= 0.3.0),
covr,
knitr,
rmarkdown
Expand Down
3 changes: 3 additions & 0 deletions tests/figs/deps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- vdiffr-svg-engine: 1.0
- vdiffr: 0.3.0
- freetypeharfbuzz: 0.2.5
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
189 changes: 189 additions & 0 deletions tests/figs/testing-methods-for-mtlr-objects/baseplot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/testthat/1curve.rds
Binary file not shown.
Binary file removed tests/testthat/1curve_colored.rds
Binary file not shown.
Binary file removed tests/testthat/curveshortx.rds
Binary file not shown.
Binary file removed tests/testthat/manycurves.rds
Binary file not shown.
Binary file removed tests/testthat/plot.rds
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/testthat/test-method.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ testthat::test_that("print and plot functions are consistent for basic survival
data <- survival::lung
mod <- mtlr(formula, data)
expect_equal_to_reference(print(mod),"print.rds")
expect_equal_to_reference(plot(mod),"plot.rds" )
basePlot <- plot(mod)
vdiffr::expect_doppelganger("basePlot", basePlot)

data <- survival::leukemia
mod <- mtlr(formula, data)
Expand Down
13 changes: 8 additions & 5 deletions tests/testthat/test-plotcurves.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ testthat::test_that("plotcurves function is consistent",{
mod <- mtlr(formula,data)
curves <- predict(mod)
expect_warning(plotcurves(curves, index= 1:3, color = c("red","green")))

expect_equal_to_reference(plotcurves(curves), "1curve.rds")
expect_equal_to_reference(plotcurves(curves, color = "pink"), "1curve_colored.rds")
expect_equal_to_reference(plotcurves(curves, index = 1:20), "manycurves.rds")
expect_equal_to_reference(plotcurves(curves, xlim = c(0,20)), "curveshortx.rds")
oneCurve <- plotcurves(curves)
vdiffr::expect_doppelganger("oneCurve", oneCurve)
onePinkCurve <- plotcurves(curves)
vdiffr::expect_doppelganger("onePinkCurve", onePinkCurve)
manyCurves <- plotcurves(curves)
vdiffr::expect_doppelganger("manyCurves", manyCurves)
shortCurve <- plotcurves(curves)
vdiffr::expect_doppelganger("shortCurve", shortCurve)
})

0 comments on commit 0e9ee90

Please sign in to comment.