tests/testthat/test_nsplit.R

# -----------------------------------------
# Test Script - Error nsplit function
# -----------------------------------------

# Required libraries
library(splitSelect)

# Context of test script
context("Verify computation of number of possible splits.")

# There should be an error if we want to compute the IF TS, and no returns are provided
test_that("Error for the \"nsplit\" function. Unequal number of possible splits.", {
  
  # Number of variables
  p <- 10
  # Number of groups
  G <- 4:5
  expect_equal(sum(nsplit(p,G)), nsplit(p, G[1]) + nsplit(p, G[2]))
})

Try the splitSelect package in your browser

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

splitSelect documentation built on Nov. 9, 2021, 9:07 a.m.