tests/testthat/test-get_constraints_strings.R

# # Note: test needs updating
#
# # path <- system.file("test_data", "scenario_0", package = "mm.reoptimise")
# path <- system.file("testdata", "three3", package = "mm.reoptimise")
# scenario <- create_scenario(path)
#
# scenario <- set_scenario(scenario,
#              period = "month",
#              budget = 3.8e7,
#              kpi1 = "Profit",
#              kpi2 = "Profit",
#              kpi3 = "Profit")
#
# optim_type <- "alloc"
#
# constant <- NULL
# # run functions that would be ran inside run_optimiaztion function ----------------
# if (is.null(constant)){
#    if(optim_type == "alloc")     constant = 1e-6
#    if(optim_type == "alloc_pct") constant = 1e10
#    if(optim_type == "net")       constant = 1e-6
# }
#
# # Create data to be used in the optimisation
# scenario$data_optim <- get_data_optim(scenario)
#
# const_strings <- get_constraints_strings(scenario, optim_type = "alloc", "month")
#
# test_that("output is a list with expected length and data types", {
#       # expect_type(const_strings, "list")
#       # expect_length(const_strings, 6)
#       # expect_true(is.character(const_strings$constraint_function))
#       # expect_true(is.character(const_strings$constraint_jacobian))
#       # expect_true(is.numeric(const_strings$num_constraints_eq))
#       # expect_true(is.numeric(const_strings$num_constraints_ineq))
#
# })
cath-parkinson/mm.reoptimise documentation built on May 12, 2022, 3:34 p.m.