source: molecuilder/src/unittests/logunittest.cpp@ 031ec24

Last change on this file since 031ec24 was 44becc, checked in by Frederik Heber <heber@…>, 16 years ago

Tests now work with Eclipse ECUT's TestRunner.

  • new switch in configure.ac: --enable-ecut
  • all tests are compiled as single test as before
  • and a new TestRunner test suite that combines all test into a single executable which can be run as CppUnit program in Eclipse (and then gives JUnit like output).
  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[96d8dc]1/*
2 * logunittest.cpp
3 */
4
5
6using namespace std;
7
8#include <cppunit/CompilerOutputter.h>
9#include <cppunit/extensions/TestFactoryRegistry.h>
10#include <cppunit/ui/text/TestRunner.h>
11
12#include "logunittest.hpp"
13#include "log.hpp"
14#include "defs.hpp"
15#include "verbose.hpp"
16
[44becc]17#ifdef HAVE_TESTRUNNER
18#include "UnitTestMain.hpp"
19#endif /*HAVE_TESTRUNNER*/
20
[96d8dc]21/********************************************** Test classes **************************************/
22
23// Registers the fixture into the 'registry'
24CPPUNIT_TEST_SUITE_REGISTRATION( LogTest );
25
26
27void LogTest::setUp()
28{
29};
30
31void LogTest::tearDown()
32{
33};
34
35/**
36 * UnitTest for log()
37 */
38void LogTest::logTest()
39{
40 logger::getInstance()->setVerbosity(2);
[543ce4]41 Log() << Verbose(0) << "Verbosity level is set to 2." << endl;
42 Log() << Verbose(0) << "Test level 0" << endl;
43 Log() << Verbose(1) << "Test level 1" << endl;
44 Log() << Verbose(2) << "Test level 2" << endl;
45 Log() << Verbose(3) << "Test level 3" << endl;
46 Log() << Verbose(4) << "Test level 4" << endl;
47
48 Log() << Verbose(0) << "Output a log message." << endl;
49 eLog() << Verbose(0) << "Output an error message." << endl;
[96d8dc]50 setVerbosity(3);
[543ce4]51 Log() << Verbose(4) << "This should not be printed." << endl;
52 eLog() << Verbose(4) << "This should not be printed." << endl;
[96d8dc]53};
Note: See TracBrowser for help on using the repository browser.