Error in `if (fun == "none") {
    return(y)
}`: the condition has length > 1

test_that("output has the correct format",
expect_error(CUSUM(x, control = list(b_n = 0)))
test_that("CUSUM test statistic is computed correctly",
numerator <- cumsum(X) - (1:N) * mean(X)
sqrt(lrv(x, control = list(kFun = "TH", b_n = 2)) * n))
sqrt(lrv(y, control = list(kFun = "TH", b_n = 2)) * n))
svd1inv <- res$u %*% diag(1 / sqrt(res$d)) %*% t(res$v)
#     mchol.inv[i, ] <<- mchol.inv[swaps[i] + 1, ]
#     mchol.inv[swaps[i] + 1, ] <<- temp
#     mchol.inv[, i] <<- mchol.inv[, swaps[i] + 1]
#     mchol.inv[, swaps[i] + 1] <<- temp
res1 <- max(apply(teststat, 1, function(x) t(x) %*% mchol.inv %*% x)) / nrow(Y)
res2 <- max(apply(teststat, 1, function(x) t(x) %*% svd1inv %*% x)) / nrow(Y)
expect_equal(res1, Ychol, tolerance = 1e-5)
expect_equal(res2, Ysvd, tolerance = 1e-5)
expect_equal(attr(CUSUM(x), "cp-location"), 50, tolerance = 1)

"CUSUM test statistic is computed correctly"

CUSUM test statistic is computed correctly

test_that("output is of the same format as input",
testFormat(function(y) psi(y, fun = "HCm"))
test_that("Time series are correctly transformed",
else return(1.5 * X.tilde[i, ] / temp[i])
if(temp[i] == 0) return(0) else return(X.tilde[i, ] / temp[i])
expect_equal(psi(X, fun = "HLm", k = 1.5), X.HLm)
expect_equal(psi(X, fun = "HLg", k = 1.5), X.HLg)
expect_equal(psi(X, fun = "SLm", k = 1.5), X.SLm)
expect_equal(psi(X, fun = "SLg", k = 1.5), X.SLg)
expect_equal(psi(X, fun = "HCm", k = 1.5), X.HCm)
expect_equal(psi(X, fun = "HCg", k = 1.5), X.HCg)
expect_equal(psi(X, fun = "SCm", k = 1.5), X.SCm)
expect_equal(psi(X, fun = "SCg", k = 1.5), X.SCg)

test_that("Cumulative sums are computed corretly",