Technique: Test Data Sets The tests all have the same structure: an input is constructed, the routine is called, and the answer is checked for correctness. Target of a test can be debugging of code or empirical study of complexity of the algorithm or comparing one algorithm against others. For example: The suited test data sets to testing the MODIFIND function follow
CONSTANT ARRAY
SORTED ARRAY
ARRAY OF DISTINCT ELEMENTS
For creating of such an array, we use the SHUFFLE subroutine:
ELEMENTS UNIFORMLY RANDOM IN INTERVAL
For creating any input array of elements with values ranging from 0 (minimum) to 100000 (maximum), we use the RANDOM builtin function:
For generation of elements with values ranging form 1 to 2147483646, there is the LCG function:
SORTED RANDOM ARRAY I
SORTED RANDOM ARRAY II
ALL PERMUTATIONS The thorough test examines FACT(N) permutations for N in [1,smallint], where
smallint is equal to 5, for example. See Generation of permutation sequences.
SHUFFLING ARRAY ACCORDING TO CERTAIN PERMUTATION
Shuffling the array A. according to certain permutation P. of set {1,...,N}. Shuffling in place
The fastest code with a temporary array follows
For a typical example of test see PROGRAM1 in Technique: Universal Unit
