Definition of tests
Rationale
This folder should hold the definition of tests for some specific DataSHIELD functions. Some functions and functionalities that can be shared between several tests and DataSHIELD function can be used again. As a result, the maintenance of the tests through time become easier and the process of writing tests should be lowered.
Test definition test
Naming definition scripts
The definition of tests are stored in some R scripts in the folder: /test/testthat/definition_tests/. Each file should be named as follow.
Â
def-[name of function in DataSHIELD].R
R Script to include as sources:
definition_tests/def-assign-stats.R : comparison between local and remotely stored data
connection_to_datasets/init_all_datasets.R: connection to the testing datasets
/test/testthat/definition_tests/def-assign-stats.R
This scripts provides some functions that compute some information related to the distribution that are stored on the server or locally.
Warnings:
Some of these values can be highly disclosive. These functions should be not be used with other datasets than the TESTING dataset.
Function name | Description |
---|---|
.calc.distribution.locally(some.local.values) | Mandatory argument: some.local.values Description: computes the mean, variance, size, minimum and maximum values of some data stored locally. Returned value: a vector of numerical in the following format: index 1 represents the mean index 2 represents the variance index 3 represents the size index 4 the minimum value index 5 the maximum value Example: dist.local.original <- .calc.distribution.locally(some.values[ ,6]) |
.calc.distribution.server(name.variable) | Mandatory argument: name.variable Description: computes the arithmetical average, variance, size, minimum and maximum values of some data stored on the server. Returned value: a vector of numerical in the following format: index 1 represents the arithmetical mean index 2 represents the variance index 3 represents the size index 4 the minimum value index 5 the maximum value Example: dist.server.original <- .calc.distribution.server('D$INTEGER') |
.compute.errors.between.distributions(first.dist, second.dist,size) | mandatory arguments:
Description: This function supports the comparison of two distributions. It computes the arithmetical average and variance for two given sets of data. Calculates the errors in both measure of centrality and dispersion. Returned value: a vector of numerical value in the following format: index 1 represents the arithmetical mean index 2 represents the variance Example: errors <- .compute.errors.between.distributions("D$INTEGER","D$POSITIVE_INTEGER",71) |
Â
DataSHIELD Wiki by DataSHIELD is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at http://www.datashield.ac.uk/wiki