Remove unreachable or otherwise redundant code
[bitcoinplatinum.git] / src / qt / test / test_main.cpp
blobcae18f41a5c50bc67ad988ed0a33744a360d8cbe
1 // Copyright (c) 2009-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #if defined(HAVE_CONFIG_H)
6 #include "config/bitcoin-config.h"
7 #endif
9 #include "chainparams.h"
10 #include "rpcnestedtests.h"
11 #include "util.h"
12 #include "uritests.h"
13 #include "compattests.h"
15 #ifdef ENABLE_WALLET
16 #include "paymentservertests.h"
17 #include "wallettests.h"
18 #endif
20 #include <QApplication>
21 #include <QObject>
22 #include <QTest>
24 #include <openssl/ssl.h>
26 #if defined(QT_STATICPLUGIN)
27 #include <QtPlugin>
28 #if QT_VERSION < 0x050000
29 Q_IMPORT_PLUGIN(qcncodecs)
30 Q_IMPORT_PLUGIN(qjpcodecs)
31 Q_IMPORT_PLUGIN(qtwcodecs)
32 Q_IMPORT_PLUGIN(qkrcodecs)
33 #else
34 #if defined(QT_QPA_PLATFORM_MINIMAL)
35 Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
36 #endif
37 #if defined(QT_QPA_PLATFORM_XCB)
38 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
39 #elif defined(QT_QPA_PLATFORM_WINDOWS)
40 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
41 #elif defined(QT_QPA_PLATFORM_COCOA)
42 Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
43 #endif
44 #endif
45 #endif
47 extern void noui_connect();
49 // This is all you need to run all the tests
50 int main(int argc, char *argv[])
52 SetupEnvironment();
53 SetupNetworking();
54 SelectParams(CBaseChainParams::MAIN);
55 noui_connect();
57 bool fInvalid = false;
59 // Prefer the "minimal" platform for the test instead of the normal default
60 // platform ("xcb", "windows", or "cocoa") so tests can't unintentially
61 // interfere with any background GUIs and don't require extra resources.
62 setenv("QT_QPA_PLATFORM", "minimal", 0);
64 // Don't remove this, it's needed to access
65 // QApplication:: and QCoreApplication:: in the tests
66 QApplication app(argc, argv);
67 app.setApplicationName("Bitcoin-Qt-test");
69 SSL_library_init();
71 URITests test1;
72 if (QTest::qExec(&test1) != 0) {
73 fInvalid = true;
75 #ifdef ENABLE_WALLET
76 PaymentServerTests test2;
77 if (QTest::qExec(&test2) != 0) {
78 fInvalid = true;
80 #endif
81 RPCNestedTests test3;
82 if (QTest::qExec(&test3) != 0) {
83 fInvalid = true;
85 CompatTests test4;
86 if (QTest::qExec(&test4) != 0) {
87 fInvalid = true;
89 #ifdef ENABLE_WALLET
90 WalletTests test5;
91 if (QTest::qExec(&test5) != 0) {
92 fInvalid = true;
94 #endif
96 return fInvalid;