summaryrefslogtreecommitdiff
path: root/tests/boost_test_main.cc
blob: 80b907eac09118d6b577558c6048d8a92ab57a8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define BOOST_TEST_NO_MAIN

#include <boost/test/unit_test.hpp>

#include <log4cxx/basicconfigurator.h>
#include <log4cxx/level.h>
#include <log4cxx/logger.h>

// One dummy test so that this can be dropped in before the actual
// test suite is written.
BOOST_AUTO_TEST_CASE(dummy)
{
}

bool init_unit_test()
{
  return true;
}

char *argv0 = NULL;

int main(int argc, char **argv)
{
  argv0 = argv[0];

  bool debug = false;
  for(int i = 1; i < argc; ++i)
    {
      if(!strcmp(argv[i], "--debug"))
	debug = true;
    }

  if(debug)
    log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getTrace());
  else
    log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getWarn());
  log4cxx::BasicConfigurator::configure();

  return boost::unit_test::unit_test_main(init_unit_test, argc, argv);
}