tests/testthat/testSmoofPackage.R

context("smoofFunctions")

checkAllBounds <- function(){
    succeeded <- T
    for(e in getAllSmoofFunctions()){
        if(length(as.vector(getSmoofFunLowerBounds(e))) < 2){
            succeeded <- F
        }
    }
    return(succeeded)
}

test_that("All Smoof functions are accessible and parameters can be read", {
    #There should be 74 non-blacklisted single objective functions
    expect_equal(length(getAllSmoofFunctions()), 74)
    expect_equal(as.vector(getSmoofFunLowerBounds("Rastrigin")),c(-5.12, -5.12))
    expect_equal(as.vector(getSmoofFunUpperBounds("Rastrigin")),c(5.12, 5.12))

    #check that bounds can be found for all existing functions
    expect_equal(checkAllBounds(), TRUE)
})

Try the spotGUI package in your browser

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

spotGUI documentation built on March 31, 2021, 1:06 a.m.