BASIS  r3148
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.

Functions

int binary_diff (const char *testfile, const char *baseline)
 Compare two files byte by byte.
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.
void testdriversetup (int *argc, char **argv[])
 Parse command-line arguments and initialize test driver.
int text_diff_lines (const char *testfile, const char *baseline, unsigned int max_number_of_differences)
 Compare two text files line by line.

Detailed Description

Default test driver implementation.

Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.
See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.

Contact: SBIA Group <sbia-software at uphs.upenn.edu>

Definition in file testdriver.hxx.


Function Documentation

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 185 of file testdriver.hxx.

vector<string> get_baseline_filenames ( string  filename_template)

Definition at line 268 of file testdriver.hxx.

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 295 of file testdriver.hxx.

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 38 of file testdriver.hxx.

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 226 of file testdriver.hxx.