22
22
#endif // ENABLE_WALLET
23
23
24
24
#include < QApplication>
25
+ #include < QDebug>
25
26
#include < QObject>
26
27
#include < QTest>
28
+
27
29
#include < functional>
28
30
29
31
#if defined(QT_STATIC)
@@ -67,8 +69,6 @@ int main(int argc, char* argv[])
67
69
gArgs .ForceSetArg (" -upnp" , " 0" );
68
70
gArgs .ForceSetArg (" -natpmp" , " 0" );
69
71
70
- bool fInvalid = false ;
71
-
72
72
// Prefer the "minimal" platform for the test instead of the normal default
73
73
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
74
74
// interfere with any background GUIs and don't require extra resources.
@@ -83,35 +83,35 @@ int main(int argc, char* argv[])
83
83
app.setApplicationName (" Dash-Qt-test" );
84
84
85
85
app.node ().context ()->args = &gArgs ; // Make gArgs available in the NodeContext
86
+
87
+ int num_test_failures{0 };
88
+
86
89
AppTests app_tests (app);
87
- if (QTest::qExec (&app_tests) != 0 ) {
88
- fInvalid = true ;
89
- }
90
+ num_test_failures += QTest::qExec (&app_tests);
91
+
90
92
OptionTests options_tests (app.node ());
91
- if (QTest::qExec (&options_tests) != 0 ) {
92
- fInvalid = true ;
93
- }
93
+ num_test_failures += QTest::qExec (&options_tests);
94
+
94
95
URITests test1;
95
- if (QTest::qExec (&test1) != 0 ) {
96
- fInvalid = true ;
97
- }
96
+ num_test_failures += QTest::qExec (&test1);
97
+
98
98
RPCNestedTests test3 (app.node ());
99
- if (QTest::qExec (&test3) != 0 ) {
100
- fInvalid = true ;
101
- }
99
+ num_test_failures += QTest::qExec (&test3);
100
+
102
101
#ifdef ENABLE_WALLET
103
102
WalletTests test5 (app.node ());
104
- if (QTest::qExec (&test5) != 0 ) {
105
- fInvalid = true ;
106
- }
103
+ num_test_failures += QTest::qExec (&test5);
104
+
107
105
AddressBookTests test6 (app.node ());
108
- if (QTest::qExec (&test6) != 0 ) {
109
- fInvalid = true ;
110
- }
106
+ num_test_failures += QTest::qExec (&test6);
111
107
#endif
112
-
113
108
TrafficGraphDataTests test7;
114
- if (QTest::qExec (&test7) != 0 )
115
- fInvalid = true ;
116
- return fInvalid ;
109
+ num_test_failures += QTest::qExec (&test7);
110
+
111
+ if (num_test_failures) {
112
+ qWarning (" \n Failed tests: %d\n " , num_test_failures);
113
+ } else {
114
+ qDebug (" \n All tests passed.\n " );
115
+ }
116
+ return num_test_failures;
117
117
}
0 commit comments