Framwork

Under construction...

The testing framework is a collection of routines which may be used to ensure that a given array is correctly sorted with respect to an unsorted original array.

These functions include:

void print( Type *const array, int n )
Print an array in the format a[1], a[2], ..., a[n - 1].
int inversions( Type *const array, int n )
Returns the number of inversions.
double ratio_of_inversions( Type *const array, int n )
Returns the ratio of the number of inversions over the number of ordered pairs: n(n + 1).
bool verify_sort( Type *unsorted_array, Type *sorted_array, int const n )
Verify that a given array is a sorted variant of the originating unsorted array. A series of error messages are printed out if a problem occurs in addition to the boolean value returned.
int infimum( Type obj, Type *const array, int n )
Finds the least index i containing a value array[i] >= obj. It is assumed that array is sorted.
int supremum( Type obj, Type *const array, int n )
Finds the greatest index i containing a value array[i] <= obj. It is assumed that array is sorted.

The definitions of infimum and supremum are such that it is always possible to iterate throught all indices occupied by an item obj by using

	for ( int i = infimum( obj, array, n ); i <= supreumum( obj, array, n ); ++i ) {
		cout << ( obj == array[i] ) << endl;
	}