README.md 1.95 KB
Newer Older
This R script helps in testing that the Load() function in a certain
's2dverification' version provides exactly the same results as another
reference version (v2.4.6 is the last version without relevant modifications
in the calculations).

In the file test.R, multiple test batteries can be defined in a list.
Each test battery can be made out of multiple tests.
Each test is a list with the parameters to test Load() with.
The arguments given to a test in a test battery will be propagated to the
next test in the test battery. It was designed this way to avoid having lots
of repeated code to test similar Load() calls.

Here an example of a set of test batteries:
```
test_batteries <- list(
  # Test battery 1
  list(
    # Test 1 from battery 1
    list(
      a = 1,
      b = 2
    ),
    # Test 2
    list(
      c = 3
    ),
    # Test 3
    list(
      b = missing_argument()
    )
  ),
  # Test battery 2
  list(
    # Test 1 from battery 2
    list(
      a = 1,
      x = 4
    ),
    list(
      y = 5,
      x = missing_argument()
    )
  )
)
```
And the resulting Load() calls:
```
# The ones from the test battery 1
Load(a = 1, b = 2)
Load(a = 1, b = 2, c = 3)
Load(a = 1, c = 3)
# The ones from the test battery 2
Load(a = 1, x = 4)
Load(a = 1, y = 5)
```

The script will run each test with the two specified installations of 
's2dverification' in the variables
```
path_to_reference_version
path_to_test_version
```

If any results differ from one version to another, the output of the two 
Load() calls will be saved in the file
'fails/test_battery_number/test_number.RData', in the variables
```
old_data
new_data
```
respectively.

Similarly, an empty file will be created for each successful test, with the
following file name: 'success/test_battery_number/test_number'

When the script is re-run and the folders 'success' and 'fails' already exist,
only the failed tests will be re-run.
If willing to re-run the entire set of test batteries, these folders must be
removed.