diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..b9a92ec --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(slopes) + +test_check("slopes") diff --git a/tests/testthat/test-slopes.R b/tests/testthat/test-slopes.R new file mode 100644 index 0000000..3833ba4 --- /dev/null +++ b/tests/testthat/test-slopes.R @@ -0,0 +1,6 @@ +test_that("slope_* functions work", { + x = c(0, 2, 3, 4, 5, 9) + e = c(1, 2, 2, 4, 3, 1) / 10 + expect_equal(slope_vector(x, e), c(0.05, 0, 0.2, -0.1, -0.05)) + # expect_equal(slope_distance(x, e), c(0.05, 0, 0.2, -0.1, -0.05)) +})