@@ -150,6 +150,28 @@ test_that("Check input: betas", {
150150 expect_true(is.zero(final $ sbm ))
151151})
152152
153+ test_that(" Check input: sigmas" , {
154+ # ## sigmas is numeric
155+ expect_error(ccdr_singleR(cors = cors.test , pp = pp , nn = nn , betas = betas.test , sigmas = rep(" a" , pp ), lambda = lambda.test , weights = weights.test , gamma = gamma.test , eps = eps.test , maxIters = maxIters.test , alpha = alpha.test ),
156+ " sigmas must be numeric" )
157+
158+ # ## sigmas has correct length
159+ expect_error(ccdr_singleR(cors = cors.test , pp = pp , nn = nn , betas = betas.test , sigmas = rep(1 , pp + 1 ), lambda = lambda.test , weights = weights.test , gamma = gamma.test , eps = eps.test , maxIters = maxIters.test , alpha = alpha.test ),
160+ " sigmas must have length" )
161+
162+ # ## Negative values other than 1 fail
163+ sigmas1 <- sigmas.test
164+ sigmas1 [1 ] <- - 2
165+ expect_error(ccdr_singleR(cors = cors.test , pp = pp , nn = nn , betas = betas.test , sigmas = sigmas1 , lambda = lambda.test , weights = weights.test , gamma = gamma.test , eps = eps.test , maxIters = maxIters.test , alpha = alpha.test ),
166+ " sigmas must be > 0!" )
167+
168+ # ## Combination of +/- values fails
169+ sigmas1 <- runif(pp )
170+ sigmas1 [1 ] <- - 1
171+ expect_error(ccdr_singleR(cors = cors.test , pp = pp , nn = nn , betas = betas.test , sigmas = sigmas1 , lambda = lambda.test , weights = weights.test , gamma = gamma.test , eps = eps.test , maxIters = maxIters.test , alpha = alpha.test ),
172+ " sigmas must be > 0!" )
173+ })
174+
153175test_that(" Check input: lambda" , {
154176
155177 # ## lambda is numeric
0 commit comments