tut logo

TUT: tut Namespace Reference


tut Namespace Reference


Detailed Description

Additional ensures for scientific/engineering applications.

Template Unit Tests Framework for C++. http://tut.dozen.ru

Author:
Vladimir Dyuzhev, Vladimir.Dyuzhev@gmail.com


Classes

struct  bad_ctor
struct  callback
class  console_reporter
class  cppunit_reporter
struct  failure
struct  group_base
struct  no_such_group
struct  no_such_test
class  restartable_wrapper
struct  rethrown
struct  seh
struct  skipped
class  test_group
struct  test_group_posix
class  test_object
struct  test_object_posix
struct  test_result
struct  test_result_posix
class  test_runner
class  test_runner_singleton
struct  tests_registerer
struct  tests_registerer< Test, Group, 0 >
struct  tut_error
struct  warning
class  xml_reporter
 JUnit XML TUT reporter. More...

Namespaces

namespace  detail
namespace  util

Typedefs

typedef std::set< callback * > callbacks
typedef std::vector< std::string > groupnames
typedef console_reporter reporter

Functions

template<typename T, typename Tolerance>
void ensure_close (const T &actual, const T &expected, const Tolerance &tolerance)
template<typename T, typename U>
void ensure_close (const char *msg, const T &actual, const T &expected, const U &tolerance)
template<typename T, typename Tolerance>
void ensure_close_fraction (const T &actual, const T &expected, const Tolerance &fraction)
template<typename T>
void ensure_close_fraction (const char *msg, const T &actual, const T &expected, const int &tolerance)
template<typename T, typename U>
void ensure_close_fraction (const char *msg, const T &actual, const T &expected, const U &fraction)
bool tut_main (int argc, const char *const *const argv, std::ostream &os=std::cerr)
template<typename T>
std::string type_name (const T &t)

Variables

test_runner_singleton runner

Typedef Documentation

typedef std::vector<std::string> tut::groupnames

Typedef for runner::list_groups()

Definition at line 107 of file tut_runner.hpp.


Function Documentation

bool tut::tut_main ( int  argc,
const char *const *const   argv,
std::ostream &  os = std::cerr 
) [inline]

Helper function to make test binaries simpler.

Example of basic usage follows.

  namespace tut { test_runner_singleton runner; }

  int main(int argc, char **argv)
  {
      if( tut_main(argc, argv) )
          return 0;
      else
          return -1;
  }

It is also possible to do some generic initialization before running any tests and cleanup before exiting application. Note that tut_main can throw tut::no_such_group or tut::no_such_test.

  namespace tut { test_runner_singleton runner; }

  int main(int argc, char **argv)
  {
      tut::xml_reporter reporter;
      tut::runner.get().insert_callback(&reporter);

      MyInit();
      try
      {
          tut_main(argc, argv);
      }
      catch(const tut::tut_error &ex)
      {
          std::cerr << "TUT error: " << ex.what() << std::endl;
      }
      MyCleanup();
  }
Examples:
basic/main.cpp.

Definition at line 54 of file tut_main.hpp.

References tut::test_result::dummy, tut::test_runner_singleton::get(), tut::test_runner::list_groups(), tut::test_result::result, tut::test_runner::run_test(), and tut::test_runner::run_tests().

Here is the call graph for this function:


All Rights Reserved. Generated on Sun Jan 31 00:39:47 2010 for TUT by doxygen 1.5.1