Skip to content

Commit cdd3f35

Browse files
committed
testthat and build
1 parent e496ba6 commit cdd3f35

7 files changed

Lines changed: 30 additions & 8 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ License: CC BY-SA 4.0
99
Encoding: UTF-8
1010
LazyData: true
1111
RoxygenNote: 7.1.0
12-
12+
Suggests: testthat, devtools

R/datsteps.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#' @export datsteps
1919

2020
datsteps <- function(DAT_df, stepsize = 25) {
21+
DAT_mat <- as.matrix(DAT_df)
2122
result <- as.data.frame(NULL)
2223
if (stepsize == "auto") {
2324
stepsize <- generate.stepsize(DAT_df)
@@ -39,3 +40,4 @@ datsteps <- function(DAT_df, stepsize = 25) {
3940
result <- create.sub.objects(DAT_df, stepsize)
4041
return(result)
4142
}
43+

man/create.sub.objects.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/generate.stepsize.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/switch.dating.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
library(testthat)
2+
library(datplot)
3+
4+
test_check("datplot")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library(datplot)
2+
library(devtools)
3+
4+
testmat <- matrix(c(1,2,3,4,6,6,8,8,0,0,50,-200,5,-200,50,5), byrow = FALSE, ncol = 4)
5+
DAT_err <- which(testmat[,3] > testmat[,4])
6+
DAT_err
7+
8+
9+
test_that("generate.stepsize returns one", {
10+
expect_equal(generate.stepsize(testmat), 1)
11+
})
12+
13+
corrmat <- matrix(c(1,2,3,4,6,6,8,8,0,-200,50,-200,5,0,50,5), byrow = FALSE, ncol = 4)
14+
test_that("switch.dating returns values correctly", {
15+
expect_equal(switch.dating(testmat, DAT_err), corrmat)
16+
})

0 commit comments

Comments
 (0)