run_model_test_cases {BioCro}R Documentation

Run BioCro model test cases

Description

BioCro models can be tested using test cases, which are sets of known outputs that correspond to particular inputs. The run_model_test_cases function runs one or more of these tests.

Note that model tests are distinct from the module tests described in module_testing.

Usage

  run_model_test_cases(model_test_cases)

Arguments

model_test_cases

A list of module test cases, each of which should be created using model_test_case.

Details

The run_model_test_cases function is a key part of the BioCro model testing system. See model_testing for more information.

For each test case, the following checks will be performed:

For each test case where check_outputs was set to TRUE, the following additional checks comparing the new result to a saved result will be performed:

When comparing the values of each column, values will only be checked for every Nth row of the new result, where N is the value of row_interval specified when defining the test case.

For each test case where check_outputs is TRUE, the stored result should be created using the update_stored_model_results function.

If any of the above checks fail for any of the supplied test cases, an error will be thrown with a descriptive message.

Besides the checks above, a warning message will also be sent to the user if there are columns in the new result that are not included in the saved result.

Value

If no issues are found, the function will return TRUE.

See Also

Examples

# Define and run a test case for the miscanthus model
miscanthus_test_case <- model_test_case(
    'miscanthus_x_giganteus',
    miscanthus_x_giganteus,
    get_growing_season_climate(weather$'2005'),
    FALSE
)

run_model_test_cases(
  list(
    miscanthus_test_case
  )
)

[Package BioCro version 3.2.0 Index]