From 68f08338e9bd29bdc52096818ce90113d6a1e8b1 Mon Sep 17 00:00:00 2001 From: Zack-83 Date: Thu, 12 Jul 2018 16:24:03 +0200 Subject: [PATCH] Span safety net for test during development --- DESCRIPTION | 4 +++- tests/testthat.R | 4 ++++ tests/testthat/test-center.R | 5 +++++ tests/testthat/test-rescale.R | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-center.R create mode 100644 tests/testthat/test-rescale.R diff --git a/DESCRIPTION b/DESCRIPTION index 79ddb3f..f1210b2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,6 +12,8 @@ License: MIT + file LICENSE Encoding: UTF-8 LazyData: true RoxygenNote: 6.0.1 -Suggests: covr +Suggests: + covr, + testthat (>= 2.0.0) Imports: dplyr (>= 0.7.6) diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..d80c467 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(maRgheRitaR) + +test_check("maRgheRitaR") diff --git a/tests/testthat/test-center.R b/tests/testthat/test-center.R new file mode 100644 index 0000000..d7d94fd --- /dev/null +++ b/tests/testthat/test-center.R @@ -0,0 +1,5 @@ +context("test-center.R") + +test_that("centering works", { + expect_equal(center(c(1,2,3),0), c(-1,0,1)) +}) diff --git a/tests/testthat/test-rescale.R b/tests/testthat/test-rescale.R new file mode 100644 index 0000000..6310a4d --- /dev/null +++ b/tests/testthat/test-rescale.R @@ -0,0 +1,5 @@ +context("test-rescale.R") + +test_that("rescaling works", { + expect_equal(rescale(1:5), 0.25*(0:4)) +})