diff options
Diffstat (limited to 'src/qt/test')
-rw-r--r-- | src/qt/test/compattests.cpp | 25 | ||||
-rw-r--r-- | src/qt/test/compattests.h | 19 | ||||
-rw-r--r-- | src/qt/test/rpcnestedtests.cpp | 23 | ||||
-rw-r--r-- | src/qt/test/test_main.cpp | 5 |
4 files changed, 12 insertions, 60 deletions
diff --git a/src/qt/test/compattests.cpp b/src/qt/test/compattests.cpp deleted file mode 100644 index c76dee5091..0000000000 --- a/src/qt/test/compattests.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2016-2019 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#if defined(HAVE_CONFIG_H) -#include <config/bitcoin-config.h> -#endif - -#include <qt/test/compattests.h> - -#include <compat/byteswap.h> - -void CompatTests::bswapTests() -{ - // Sibling in bitcoin/src/test/bswap_tests.cpp - uint16_t u1 = 0x1234; - uint32_t u2 = 0x56789abc; - uint64_t u3 = 0xdef0123456789abc; - uint16_t e1 = 0x3412; - uint32_t e2 = 0xbc9a7856; - uint64_t e3 = 0xbc9a78563412f0de; - QVERIFY(bswap_16(u1) == e1); - QVERIFY(bswap_32(u2) == e2); - QVERIFY(bswap_64(u3) == e3); -} diff --git a/src/qt/test/compattests.h b/src/qt/test/compattests.h deleted file mode 100644 index 1af97696b2..0000000000 --- a/src/qt/test/compattests.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2009-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. - -#ifndef BITCOIN_QT_TEST_COMPATTESTS_H -#define BITCOIN_QT_TEST_COMPATTESTS_H - -#include <QObject> -#include <QTest> - -class CompatTests : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void bswapTests(); -}; - -#endif // BITCOIN_QT_TEST_COMPATTESTS_H diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp index 0d9928d363..9e6e98b274 100644 --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -11,8 +11,10 @@ #include <univalue.h> #include <util/system.h> -#include <QDir> -#include <QtGlobal> +#include <QTest> + +#include <string> +#include <stdexcept> static RPCHelpMan rpcNestedTest_rpc() { @@ -24,9 +26,9 @@ static RPCHelpMan rpcNestedTest_rpc() {"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""}, {"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""}, }, - {}, + RPCResult{RPCResult::Type::ANY, "", ""}, RPCExamples{""}, - [](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { + [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { return request.params.write(0, 0); }, }; @@ -68,13 +70,13 @@ void RPCNestedTests::rpcNestedTests() RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo "); //whitespace at the end will be tolerated QVERIFY(result.substr(0,1) == "{"); - (RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]")); //Quote path identifier are allowed, but look after a child containing the quotes in the key + RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]"); //Quote path identifier are allowed, but look after a child containing the quotes in the key QVERIFY(result == "null"); - (RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0")); //parameter not in brackets are allowed - (RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)")); //parameter in brackets are allowed + RPCConsole::RPCExecuteCommandLine(m_node, result, "createrawtransaction [] {} 0"); //parameter not in brackets are allowed + RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction([],{},0)"); //parameter in brackets are allowed QVERIFY(result == result2); - (RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )")); //whitespace between parameters is allowed + RPCConsole::RPCExecuteCommandLine(m_node, result2, "createrawtransaction( [], {} , 0 )"); //whitespace between parameters is allowed QVERIFY(result == result2); RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock(getbestblockhash())[tx][0]", &filtered); @@ -123,11 +125,10 @@ void RPCNestedTests::rpcNestedTests() RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest( abc , cba )"); QVERIFY(result == "[\"abc\",\"cba\"]"); - // do the QVERIFY_EXCEPTION_THROWN checks only with Qt5.3 and higher (QVERIFY_EXCEPTION_THROWN was introduced in Qt5.3) QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() .\n"), std::runtime_error); //invalid syntax QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo() getblockchaininfo()"), std::runtime_error); //invalid syntax - (RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(")); //tolerate non closing brackets if we have no arguments - (RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()")); //tolerate non command brackets + RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo("); //tolerate non closing brackets if we have no arguments + RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()()()"); //tolerate non command brackets QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo(True)"), UniValue); //invalid argument QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "a(getblockchaininfo(True))"), UniValue); //method not found QVERIFY_EXCEPTION_THROWN(RPCConsole::RPCExecuteCommandLine(m_node, result, "rpcNestedTest abc,,abc"), std::runtime_error); //don't tolerate empty arguments when using , diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index a1baf6a402..eb86f027ef 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -11,7 +11,6 @@ #include <qt/test/apptests.h> #include <qt/test/rpcnestedtests.h> #include <qt/test/uritests.h> -#include <qt/test/compattests.h> #include <test/util/setup_common.h> #ifdef ENABLE_WALLET @@ -92,10 +91,6 @@ int main(int argc, char* argv[]) if (QTest::qExec(&test3) != 0) { fInvalid = true; } - CompatTests test4; - if (QTest::qExec(&test4) != 0) { - fInvalid = true; - } #ifdef ENABLE_WALLET WalletTests test5(app.node()); if (QTest::qExec(&test5) != 0) { |