Skip to content

Commit

Permalink
Fix bug in glSim that calls parallel if turned off.
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Feb 5, 2016
1 parent 0d21159 commit 69912c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/glSim.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ glSim <- function(n.ind, n.snp.nonstruc, n.snp.struc = 0, grp.size = c(0.5, 0.5)
pop <- res.ns[[2]]
res.ns <- res.ns[[1]]
if(n.snp.struc>0){
res <- cbind(res.ns, struct)
res <- cbind(res.ns, struct, parallel = parallel)
res@pop <- phen
}
else{
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test_genlight.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,15 @@ test_that("genlight objects do not take a mixture of positive and negative subsc
skip_on_cran()
expect_error(xx[, c(2, -1)], "subscripts.")
})


test_that("glSim does not call parallel by default", {
skip_on_cran()
detach("package:parallel")
no_parallel <- sessionInfo()$basePkgs
expect_false("parallel" %in% no_parallel)
x <- glSim(2, n.snp.nonstruc = 10, n.snp.struc = 10, parallel = FALSE)
check_parallel <- sessionInfo()$basePkgs
expect_false("parallel" %in% check_parallel)
expect_is(x, "genlight")
})

0 comments on commit 69912c7

Please sign in to comment.