tests/testthat/test-whatif_convexhull.R

test_that("REQUIRE TEST whatif with 1 counterfactual", {
    skip_on_cran()
    
    my.cfact <- matrix(rnorm(3*5), ncol = 5)
    my.data <- matrix(rnorm(100*5), ncol = 5)
    
    expect_error(whatif(data = my.data, cfact = matrix(my.cfact[1,], nrow = 1), 
                        mc.cores = 1), NA) 
})


test_that("REQUIRE TEST multitreaded", {
    my.cfact <- matrix(rnorm(3*5), ncol = 5)
    my.data <- matrix(rnorm(100*5), ncol = 5)
    
    with_mock(
        `WhatIf::whatif` = function(...) print("3 cores"),
        expect_error(whatif(data = my.data, cfact = my.cfact, 
                        mc.cores = 3), NA) 
    )
})

Try the WhatIf package in your browser

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

WhatIf documentation built on Nov. 14, 2020, 5:13 p.m.