test_wrapper: Test model wrappers

View source: R/test_wrapper.R

test_wrapperR Documentation

Test model wrappers

Description

This function perform some tests of CroptimizR model wrappers. See @details for more information.

Usage

test_wrapper(
  model_function,
  model_options,
  param_values,
  situation,
  var = NULL,
  sit_names = lifecycle::deprecated(),
  var_names = lifecycle::deprecated()
)

Arguments

model_function

Crop Model wrapper function to use.

model_options

List of options for the Crop Model wrapper (see help of the Crop Model wrapper function used).

param_values

a named vector that contains values and names for AT LEAST TWO model parameters THAT ARE EXPECTED TO PLAY ON ITS RESULTS.

situation

Vector of situations names for which results must be tested.

var

(optional) Vector of variables names for which results must be tested.

sit_names

[Deprecated] sit_names is no longer supported, use situation instead.

var_names

[Deprecated] var_names is no longer supported, use var instead.

Details

This function runs the wrapper consecutively with different subsets of param_values. It then checks:

  • the format of the returned results

  • the results are different when different subsets of param_values are used,

  • the results are identical when same subsets of param_values are used.

Value

A list containing:

  • test_results: a vector of boolean indicating which test succeeded (TRUE) or failed (FALSE)

  • param_values_1: first subset of param_values

  • param_values_2: second subset of param_values

  • sim_1: results obtained with param_values_1

  • sim_2: results obtained with param_values_2

  • sim_3: results obtained for second run with param_values_1


SticsRPacks/CroptimizR documentation built on Dec. 16, 2024, 11:54 a.m.