An "Hello, world!" program for TUT

After the "Hello, world" program for CppUnit, I committed another one for the TUT framework. It has been compiled with TUT-2007-07-06.

#include <tut.h>
#include <tut_reporter.h>
#include <iostream>

namespace tut
  struct EmptyFixture {};

  typedef test_group<EmptyFixture> testsuite;
  typedef testsuite::object testcase;
  testsuite mysuite("hello");

  void testcase::test<1>()
     std::cout << "Hello, world!" << std::endl;

int main(int ac, const char **av)
  tut::reporter visi;


  catch( const std::exception& ex )
    std::cerr << "tut raised ex: " << ex.what() << std::endl;
    return 1;

  return 0;

The TUT framework has an unusual syntax compared to the other frameworks of the xUnit family. However, being no more than a singler header file, it is very easy to start using it.
Be careful with the order of the assertions terms, since they're swapped.


Here is the command line to compile the sample above:

g++ hwtut.cpp -I${TUT_DIR} -o hwtut
where $TUT_DIR refers to the location of the TUT header files.

Last modified: Nov 2oo7