2018-12-30 03:33:15 +01:00
|
|
|
/*
|
|
|
|
* test_runner.cpp
|
|
|
|
* Author: Benjamin Sergeant
|
|
|
|
* Copyright (c) 2018 Machine Zone. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define CATCH_CONFIG_RUNNER
|
|
|
|
#include "catch.hpp"
|
2019-05-10 00:30:44 +02:00
|
|
|
#include <ixcore/utils/IXCoreLogger.h>
|
2019-09-23 19:25:23 +02:00
|
|
|
#include <ixwebsocket/IXNetSystem.h>
|
|
|
|
#include <spdlog/spdlog.h>
|
2019-04-26 01:38:15 +02:00
|
|
|
|
2020-07-25 03:12:07 +02:00
|
|
|
#ifndef _WIN32
|
|
|
|
#include <signal.h>
|
|
|
|
#endif
|
|
|
|
|
2019-02-21 03:59:07 +01:00
|
|
|
int main(int argc, char* argv[])
|
2018-12-30 03:33:15 +01:00
|
|
|
{
|
2019-04-26 01:38:15 +02:00
|
|
|
ix::initNetSystem();
|
|
|
|
|
2020-07-25 03:12:07 +02:00
|
|
|
#ifndef _WIN32
|
|
|
|
signal(SIGPIPE, SIG_IGN);
|
|
|
|
#endif
|
|
|
|
|
2020-04-25 00:17:50 +02:00
|
|
|
ix::CoreLogger::LogFunc logFunc = [](const char* msg, ix::LogLevel level) {
|
|
|
|
switch (level)
|
|
|
|
{
|
|
|
|
case ix::LogLevel::Debug:
|
|
|
|
{
|
|
|
|
spdlog::debug(msg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ix::LogLevel::Info:
|
|
|
|
{
|
|
|
|
spdlog::info(msg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ix::LogLevel::Warning:
|
|
|
|
{
|
|
|
|
spdlog::warn(msg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ix::LogLevel::Error:
|
|
|
|
{
|
|
|
|
spdlog::error(msg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ix::LogLevel::Critical:
|
|
|
|
{
|
|
|
|
spdlog::critical(msg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ix::CoreLogger::setLogFunction(logFunc);
|
2020-07-25 03:12:07 +02:00
|
|
|
spdlog::set_level(spdlog::level::debug);
|
2019-05-10 00:30:44 +02:00
|
|
|
|
2018-12-30 03:33:15 +01:00
|
|
|
int result = Catch::Session().run(argc, argv);
|
2019-04-26 01:38:15 +02:00
|
|
|
|
|
|
|
ix::uninitNetSystem();
|
2018-12-30 03:33:15 +01:00
|
|
|
return result;
|
|
|
|
}
|