Module test case files form a critical component of BioCro's regression
testing system. For more details, see the help page for
module_testing.
The initialize_csv function will evaluate the module for a set of input
quantities and store the results as a test case csv file. Typically,
both of its optional arguments can be omitted. However, some modules produce
errors when all inputs are set to 1.0. In this case, it would be necessary to
supply some nonstandard inputs and (possibly) an alternate case description.
The add_csv_row function will evaluate the module for a set of input
quantities, define a test case from the resulting outputs and the description,
and add it to the module's corresponding csv file. If no csv
file exists, one will be initialized with the new case.
The update_csv_cases function will evaluate the module for all input
values specified in its csv case file and update the stored values of
the corresponding outputs. Any output columns not present in the file will be
added automatically and filled in with the correct values. Although the output
columns are optional, the description column must exist in the csv
file.
If a module test fails and update_csv_cases is used to update the test,
care should be taken to ensure that the new outputs are sensible. This
function should not be used to blindly ensure that tests pass, since a test
failure may indicate a real problem with a module.
Note that update_csv_cases can be used to batch-initialize test cases.
To do this, manually create a test case csv file with the proper name
that only includes columns for the inputs and the description; now, calling
update_csv_cases will automatically fill in the outputs for each case.
With this method, care must be taken when manually specifying the values of
the description column; the descriptions must be double quoted, and if they
contain internal double quotes, those quotes must be doubled. Generally it is
safest to simply avoid double quotes in the descriptions. (See qmethod
in the help file for write.csv for more details about quoting.)