Macros | Functions
testdriver.hxx File Reference

Default test driver implementation. More...

#include <iterator>
#include <unistd.h>
+ Include dependency graph for testdriver.hxx:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _BASIS_TESTDRIVER_HXX
 

Functions

int binary_diff (const char *testfile, const char *baseline)
 Compare two files byte by byte. More...
 
vector< string > get_baseline_filenames (string filename_template)
 
int image_regression_test (const char *imagefile, const char *baseline, double intensity_tolerance, unsigned int max_number_of_differences, unsigned int tolerance_radius, bool orientation_insensitive, int report)
 Compare output image to baseline image. More...
 
void testdriversetup (int *argc, char **argv[])
 Parse command-line arguments and initialize test driver. More...
 
int text_diff_lines (const char *testfile, const char *baseline, unsigned int max_number_of_differences)
 Compare two text files line by line. More...
 

Detailed Description

Default test driver implementation.

Definition in file testdriver.hxx.

Macro Definition Documentation

§ _BASIS_TESTDRIVER_HXX

#define _BASIS_TESTDRIVER_HXX

Definition at line 17 of file testdriver.hxx.

Function Documentation

§ binary_diff()

int binary_diff ( const char *  testfile,
const char *  baseline 
)

Compare two files byte by byte.

Parameters
[in]testfileFile generated by test.
[in]baselineBaseline file.
Return values
-1if the test file could not be read
-2if the baseline file could not be read
0if the two files are identical
1if the two files differ

Definition at line 189 of file testdriver.hxx.

§ get_baseline_filenames()

vector<string> get_baseline_filenames ( string  filename_template)

Definition at line 272 of file testdriver.hxx.

§ image_regression_test()

int image_regression_test ( const char *  imagefile,
const char *  baseline,
double  intensity_tolerance = 2.0,
unsigned int  max_number_of_differences = 0,
unsigned int  tolerance_radius = 0,
bool  orientation_insensitive = false,
int  report = 0 
)

Compare output image to baseline image.

This function compares a given image to a baseline image and returns a regression test result depending on how well the output image matches the baseline image given the provided tolerance arguments.

Parameters
[in]imagefileOutput image file of test run.
[in]baselineBaseline image file.
[in]intensity_toleranceMaximum tolerable intensity difference.
[in]max_number_of_differencesMaximum number of differing pixels.
[in]tolerance_radiusTolerance radius.
[in]orientation_insensitiveChange orientation of both images to a common coordinate orientation before comparing them.
[in]reportLevel of test report to generate. If zero, no report is generated. If greater than zero, a report is generated. Similar to the verbosity of a program, is this parameter used to set the verbosity of the report. Most implementations yet only either generate a (full) report or none.
Returns
Number of voxels with a difference above the set intensity_tolerance.

Definition at line 299 of file testdriver.hxx.

§ testdriversetup()

void testdriversetup ( int *  argc,
char **  argv[] 
)

Parse command-line arguments and initialize test driver.

Parameters
[in]argcNumber of arguments.
[in]argvCommand-line arguments.

Definition at line 42 of file testdriver.hxx.

§ text_diff_lines()

int text_diff_lines ( const char *  testfile,
const char *  baseline,
unsigned int  max_number_of_differences = 0 
)

Compare two text files line by line.

Parameters
[in]testfileFile generated by test.
[in]baselineBaseline file.
[in]max_number_of_differencesNumber of lines that may differ at most.
Return values
-1if the test file could not be read
-2if the baseline file could not be read
0if the two files differ in no more than max_number_of_differences lines
1if the two files differ in more than the allowed number of lines

Definition at line 230 of file testdriver.hxx.