From 502a822d112207e9867c21855dd9c6dc3990d699 Mon Sep 17 00:00:00 2001 From: David Lawrence Miller Date: Sat, 26 May 2018 14:14:39 +0100 Subject: [PATCH] beginnings of testing system, version bump --- DESCRIPTION | 5 +++-- tests/testthat.R | 4 ++++ tests/testthat/test_everything.R | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test_everything.R diff --git a/DESCRIPTION b/DESCRIPTION index a6b7a72..931ecf2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: readdst Title: Convert Distance for Windows projects to R analyses -Version: 0.0.4 +Version: 0.0.5 Authors@R: person("David", "Miller", , "dave@ninepointeightone.net", role = c("aut", "cre")) Description: Take projects built using Distance for Windows and create R scripts which duplicate the analysis. Optionally build a test suite that checks analysis results from Distance with the equivalent R results. Depends: @@ -15,6 +15,7 @@ Imports: testthat, plyr Suggests: - knitr + knitr, + testthat VignetteBuilder: knitr RoxygenNote: 6.0.1 diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..62fa382 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(readdst) + +test_check("readdst") diff --git a/tests/testthat/test_everything.R b/tests/testthat/test_everything.R new file mode 100644 index 0000000..aa8b6da --- /dev/null +++ b/tests/testthat/test_everything.R @@ -0,0 +1,31 @@ +# this just tests all the projects that we ship with readdst +library(readdst) +# we expect everything to work! + +# do a pretty printer... +this_project <- system.file("Stratify-solutions", package="readdst") +this_project <- paste0(this_project, "/Stratify\\ solutions") + +#for(this_project in projects){ +context(this_project) + +cc <- convert_project(this_project) +for(i in seq_along(cc)){ + + + result <- test_stats(cc[[i]], 1:2) + + test_that(names(cc)[i],{ + for(j in 1:nrow(result)){ + expect_equal(result$Pass[j], "✓", info=result$Statistic[[j]]) + } + }) +} + + + + + + + +#}