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 May 29, 2024, 5:24 a.m.