summaryrefslogtreecommitdiff
path: root/src/components/test_main.cc
blob: 62442cb64ffa63812ee8a6ae5c341f6202b16489 (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
#include <iostream>
#include "gmock/gmock.h"
#include "utils/custom_string.h"

#ifdef ENABLE_LOG
#include "utils/logger/log4cxxlogger.h"
#include "utils/logger/logger_impl.h"
#endif  // ENABLE_LOG

#include "utils/logger.h"

SDL_CREATE_LOG_VARIABLE("SDLMain")
int main(int argc, char** argv) {
#ifdef ENABLE_LOG
  // --------------------------------------------------------------------------
  // Logger initialization
  // Redefine for each paticular logger implementation
  auto logger = std::unique_ptr<logger::Log4CXXLogger>(
      new logger::Log4CXXLogger("log4cxx.properties"));
  auto logger_impl =
      std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl(false));
  logger::Logger::instance(logger_impl.get());
#endif  // ENABLE_LOG

  namespace custom_str = utils::custom_string;
  testing::InitGoogleMock(&argc, argv);
  ::testing::DefaultValue<custom_str::CustomString>::Set(
      custom_str::CustomString(""));
  const int result = RUN_ALL_TESTS();

  SDL_DEINIT_LOGGER();
  return result;
}