forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_dash_main.cpp
60 lines (47 loc) · 1.29 KB
/
test_dash_main.cpp
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#define BOOST_TEST_MODULE Dash Test Suite
#include <net.h>
#include <stacktraces.h>
#include <memory>
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_monitor.hpp>
std::unique_ptr<CConnman> g_connman;
[[noreturn]] void Shutdown(void* parg)
{
std::exit(EXIT_SUCCESS);
}
[[noreturn]] void StartShutdown()
{
std::exit(EXIT_SUCCESS);
}
bool ShutdownRequested()
{
return false;
}
template<typename T>
void translate_exception(const T &e)
{
std::cerr << GetPrettyExceptionStr(std::current_exception()) << std::endl;
throw;
}
template<typename T>
void register_exception_translator()
{
boost::unit_test::unit_test_monitor.register_exception_translator<T>(&translate_exception<T>);
}
struct ExceptionInitializer {
ExceptionInitializer()
{
RegisterPrettyTerminateHander();
RegisterPrettySignalHandlers();
register_exception_translator<std::exception>();
register_exception_translator<std::string>();
register_exception_translator<const char*>();
}
~ExceptionInitializer()
{
}
};
BOOST_GLOBAL_FIXTURE(ExceptionInitializer);