Functions
contrib/mul/mbl/mbl_test.h File Reference

A place for useful things associated with testing. More...

#include <vcl_sstream.h>
#include <vcl_string.h>
#include <vcl_iostream.h>
#include <vcl_vector.h>
#include <vul/vul_reg_exp.h>

Go to the source code of this file.

Functions

template<class S >
bool mbl_test_summaries_are_equal (const S &a, const S &b, const char **exceptions=0)
 Test if the summaries of two objects are the same.
void mbl_test_save_measurement (const vcl_string &measurement_path, double value)
 A historical measurement recording framework.

Detailed Description

A place for useful things associated with testing.

Author:
iscott
Date:
Dec 2003

Definition in file mbl_test.h.


Function Documentation

void mbl_test_save_measurement ( const vcl_string &  measurement_path,
double  value 
)

A historical measurement recording framework.

The function will append the measurement to the file specified by $CMAKE_VAR{VXL_MBL_TEST_SAVE_MEASUREMENT_PATH}/measurement_path. The value is also copied to stdout where it can be automatically picked up by CTest and Dart. We suggest formatting the measurement path as follows "path/from/code/root/to/test_source_filename_minus_extension/MEASUREMENT_DESCRIPTION", e.g. in the file "$CODE_SRC/algo/krr/tests/test_krr_optimise_model_parameters.cxx"

   mbl_test_save_measurement("algo/krr/tests/test_krr_optimise_model_parameters/Point_To_Point_RMS_Error",value);
   

Currently the function will append the measurement to the file specified by ${MBL_TEST_SAVE_MEASUREMENT_PATH}/measurement_path, and exports it to Dart. In the longer term it may save the value via Dart2.

Definition at line 55 of file mbl_test.cxx.

template<class S >
bool mbl_test_summaries_are_equal ( const S &  a,
const S &  b,
const char **  exceptions = 0 
)

Test if the summaries of two objects are the same.

Both objects a and b must be the same class, and have vsl_print_summary defined for them.

Parameters:
exceptionsis an optional, 0 terminated, list of c-strings.

Any pair of lines from the two summaries that don't match each other, but do match one of the exception regular expressions will be ignored.

  base_class_wibble *base_ptr, *base_ptr2;
  ...
  // Compare but ignore all lines containing the string "Model address:" :
  const char *exceptions[] = { "Model address:", 0}; // Don't forget terminating 0

  TEST("saved and loaded extractors are identical",
       mbl_test_summaries_are_equal(base_ptr,base_ptr2, exceptions),
       true);

Definition at line 36 of file mbl_test.h.