tests/test_getNextSet.R

library(pcalg)

my.stop <- FALSE
tmp.set <- c(1,2,3)
res <- NULL

while(!my.stop) {
  tmp <- getNextSet(5,3,tmp.set)
  tmp.set <- tmp$nextSet
  if (tmp$wasLast) {
    my.stop <- TRUE
  } else {
    res <- rbind(res,tmp.set)
  }
}

resTrue <- rbind(c(1,2,4),
                 c(1,2,5),
                 c(1,3,4),
                 c(1,3,5),
                 c(1,4,5),
                 c(2,3,4),
                 c(2,3,5),
                 c(2,4,5),
                 c(3,4,5))

if(any(resTrue!=res)) {
  stop("Test of getNextSet: Theoretical values not reproduced!")
}

Try the pcalg package in your browser

Any scripts or data that you put into this service are public.

pcalg documentation built on Sept. 26, 2023, 9:06 a.m.