Skip to content
Snippets Groups Projects
Commit 3c57e4e6 authored by Nathalie Vialaneix's avatar Nathalie Vialaneix
Browse files

created framework to deal with tests using testthat

parent b6c8aa3d
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@ Imports:
dendextend,
reshape2,
RColorBrewer
Suggests:
testthat
License: GPL (>= 2)
RoxygenNote: 7.1.2
Encoding: UTF-8
......
library("testthat")
library("SISIR")
test_check("SISIR")
library(SISIR)
library("SISIR")
context("Testing ridge regression `ridgeSIR`")
test_that("Normalization in ridgeSIR works as expected.", {
set.seed(1140)
tsteps <- seq(0, 1, length = 200)
......@@ -15,7 +18,8 @@ res_ridge <- ridgeSIR(x, y, H = 10, d = 5, mu2 = 10^8)
# test if normalization is OK
norm_EDR <- res_ridge$utils$norm_EDR
stopifnot(max(abs(
diag(res_ridge$parameters$d) -
crossprod(res_ridge$EDR, norm_EDR) %*% res_ridge$EDR
)) < 10^(-10))
expect_equal(diag(res_ridge$parameters$d),
crossprod(res_ridge$EDR, norm_EDR) %*% res_ridge$EDR,
tolerance = 10^(-10))
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment