mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-30 11:56:50 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71866d8566 | ||
|
|
60ca24a506 | ||
|
|
2bd5fdbced | ||
|
|
430808ab13 | ||
|
|
1fd91da454 | ||
|
|
eba46583ed | ||
|
|
7e1b968f61 | ||
|
|
4607f700d0 | ||
|
|
cbdfb46b55 | ||
|
|
0dcbd2ee93 |
@@ -12,6 +12,7 @@
|
||||
<ClCompile Include="..\..\src\test\util\setup_common.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\test\addressbooktests.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\test\apptests.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\test\optiontests.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\test\rpcnestedtests.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\test\test_main.cpp" />
|
||||
<ClCompile Include="..\..\src\qt\test\uritests.cpp" />
|
||||
@@ -20,6 +21,7 @@
|
||||
<ClCompile Include="..\..\src\wallet\test\wallet_test_fixture.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_addressbooktests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_apptests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_optiontests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_rpcnestedtests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_uritests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_wallettests.cpp" />
|
||||
@@ -88,6 +90,7 @@
|
||||
<ItemGroup>
|
||||
<MocTestFiles Include="..\..\src\qt\test\addressbooktests.h" />
|
||||
<MocTestFiles Include="..\..\src\qt\test\apptests.h" />
|
||||
<MocTestFiles Include="..\..\src\qt\test\optiontests.h" />
|
||||
<MocTestFiles Include="..\..\src\qt\test\rpcnestedtests.h" />
|
||||
<MocTestFiles Include="..\..\src\qt\test\uritests.h" />
|
||||
<MocTestFiles Include="..\..\src\qt\test\wallettests.h" />
|
||||
|
||||
@@ -2,7 +2,7 @@ AC_PREREQ([2.69])
|
||||
define(_CLIENT_VERSION_MAJOR, 23)
|
||||
define(_CLIENT_VERSION_MINOR, 0)
|
||||
define(_CLIENT_VERSION_BUILD, 0)
|
||||
define(_CLIENT_VERSION_RC, 1)
|
||||
define(_CLIENT_VERSION_RC, 2)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||
define(_COPYRIGHT_YEAR, 2022)
|
||||
define(_COPYRIGHT_HOLDERS,[The %s developers])
|
||||
|
||||
@@ -227,7 +227,7 @@ SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(git -c log.showSignature=false log --f
|
||||
time-machine() {
|
||||
# shellcheck disable=SC2086
|
||||
guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \
|
||||
--commit=aa34d4d28dfe25ba47d5800d05000fb7221788c0 \
|
||||
--commit=ae03f401381e956c4c41b4cf495cbde964fa43d0 \
|
||||
--cores="$JOBS" \
|
||||
--keep-failed \
|
||||
--fallback \
|
||||
|
||||
@@ -490,7 +490,7 @@ and endian independent.")
|
||||
(license license:expat)))
|
||||
|
||||
(define-public python-signapple
|
||||
(let ((commit "b084cbbf44d5330448ffce0c7d118f75781b64bd"))
|
||||
(let ((commit "0777ce58e61b0e6be753a5f524149d6d47905186"))
|
||||
(package
|
||||
(name "python-signapple")
|
||||
(version (git-version "0.1" "1" commit))
|
||||
@@ -503,7 +503,7 @@ and endian independent.")
|
||||
(file-name (git-file-name name commit))
|
||||
(sha256
|
||||
(base32
|
||||
"0k7inccl2mzac3wq4asbr0kl8s4cghm8982z54kfascqg45shv01"))))
|
||||
"19axspyyfqbrfw2r53c17mi9bvm8zsb39mz8v9h7c173qkm3x5ym"))))
|
||||
(build-system python-build-system)
|
||||
(propagated-inputs
|
||||
`(("python-asn1crypto" ,python-asn1crypto)
|
||||
|
||||
@@ -8,9 +8,11 @@ set -e
|
||||
|
||||
ROOTDIR=dist
|
||||
BUNDLE="${ROOTDIR}/Bitcoin-Qt.app"
|
||||
BINARY="${BUNDLE}/Contents/MacOS/Bitcoin-Qt"
|
||||
SIGNAPPLE=signapple
|
||||
TEMPDIR=sign.temp
|
||||
OUT=signature-osx.tar.gz
|
||||
ARCH=$(${SIGNAPPLE} info ${BINARY} | head -n 1 | cut -d " " -f 1)
|
||||
OUT="signature-osx-${ARCH}.tar.gz"
|
||||
OUTROOT=osx/dist
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH BITCOIN-CLI "1" "March 2022" "bitcoin-cli v23.0.0rc1" "User Commands"
|
||||
.TH BITCOIN-CLI "1" "March 2022" "bitcoin-cli v23.0.0rc2" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-cli \- manual page for bitcoin-cli v23.0.0rc1
|
||||
bitcoin-cli \- manual page for bitcoin-cli v23.0.0rc2
|
||||
.SH SYNOPSIS
|
||||
.B bitcoin-cli
|
||||
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Bitcoin Core\/\fR
|
||||
@@ -15,7 +15,7 @@ bitcoin-cli \- manual page for bitcoin-cli v23.0.0rc1
|
||||
.B bitcoin-cli
|
||||
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core RPC client version v23.0.0rc1
|
||||
Bitcoin Core RPC client version v23.0.0rc2
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH BITCOIN-QT "1" "March 2022" "bitcoin-qt v23.0.0rc1" "User Commands"
|
||||
.TH BITCOIN-QT "1" "March 2022" "bitcoin-qt v23.0.0rc2" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-qt \- manual page for bitcoin-qt v23.0.0rc1
|
||||
bitcoin-qt \- manual page for bitcoin-qt v23.0.0rc2
|
||||
.SH SYNOPSIS
|
||||
.B bitcoin-qt
|
||||
[\fI\,command-line options\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core version v23.0.0rc1
|
||||
Bitcoin Core version v23.0.0rc2
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH BITCOIN-TX "1" "March 2022" "bitcoin-tx v23.0.0rc1" "User Commands"
|
||||
.TH BITCOIN-TX "1" "March 2022" "bitcoin-tx v23.0.0rc2" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-tx \- manual page for bitcoin-tx v23.0.0rc1
|
||||
bitcoin-tx \- manual page for bitcoin-tx v23.0.0rc2
|
||||
.SH SYNOPSIS
|
||||
.B bitcoin-tx
|
||||
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded bitcoin transaction\/\fR
|
||||
@@ -9,7 +9,7 @@ bitcoin-tx \- manual page for bitcoin-tx v23.0.0rc1
|
||||
.B bitcoin-tx
|
||||
[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded bitcoin transaction\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core bitcoin\-tx utility version v23.0.0rc1
|
||||
Bitcoin Core bitcoin\-tx utility version v23.0.0rc2
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH BITCOIN-UTIL "1" "March 2022" "bitcoin-util v23.0.0rc1" "User Commands"
|
||||
.TH BITCOIN-UTIL "1" "March 2022" "bitcoin-util v23.0.0rc2" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-util \- manual page for bitcoin-util v23.0.0rc1
|
||||
bitcoin-util \- manual page for bitcoin-util v23.0.0rc2
|
||||
.SH SYNOPSIS
|
||||
.B bitcoin-util
|
||||
[\fI\,options\/\fR] [\fI\,commands\/\fR] \fI\,Do stuff\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core bitcoin\-util utility version v23.0.0rc1
|
||||
Bitcoin Core bitcoin\-util utility version v23.0.0rc2
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH BITCOIN-WALLET "1" "March 2022" "bitcoin-wallet v23.0.0rc1" "User Commands"
|
||||
.TH BITCOIN-WALLET "1" "March 2022" "bitcoin-wallet v23.0.0rc2" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-wallet \- manual page for bitcoin-wallet v23.0.0rc1
|
||||
bitcoin-wallet \- manual page for bitcoin-wallet v23.0.0rc2
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core bitcoin\-wallet version v23.0.0rc1
|
||||
Bitcoin Core bitcoin\-wallet version v23.0.0rc2
|
||||
.PP
|
||||
bitcoin\-wallet is an offline tool for creating and interacting with Bitcoin Core wallet files.
|
||||
By default bitcoin\-wallet will act on wallets in the default mainnet wallet directory in the datadir.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
|
||||
.TH BITCOIND "1" "March 2022" "bitcoind v23.0.0rc1" "User Commands"
|
||||
.TH BITCOIND "1" "March 2022" "bitcoind v23.0.0rc2" "User Commands"
|
||||
.SH NAME
|
||||
bitcoind \- manual page for bitcoind v23.0.0rc1
|
||||
bitcoind \- manual page for bitcoind v23.0.0rc2
|
||||
.SH SYNOPSIS
|
||||
.B bitcoind
|
||||
[\fI\,options\/\fR] \fI\,Start Bitcoin Core\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core version v23.0.0rc1
|
||||
Bitcoin Core version v23.0.0rc2
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
|
||||
@@ -7,6 +7,7 @@ TESTS += qt/test/test_bitcoin-qt
|
||||
|
||||
TEST_QT_MOC_CPP = \
|
||||
qt/test/moc_apptests.cpp \
|
||||
qt/test/moc_optiontests.cpp \
|
||||
qt/test/moc_rpcnestedtests.cpp \
|
||||
qt/test/moc_uritests.cpp
|
||||
|
||||
@@ -19,6 +20,7 @@ endif # ENABLE_WALLET
|
||||
TEST_QT_H = \
|
||||
qt/test/addressbooktests.h \
|
||||
qt/test/apptests.h \
|
||||
qt/test/optiontests.h \
|
||||
qt/test/rpcnestedtests.h \
|
||||
qt/test/uritests.h \
|
||||
qt/test/util.h \
|
||||
@@ -30,6 +32,7 @@ qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_
|
||||
qt_test_test_bitcoin_qt_SOURCES = \
|
||||
init/bitcoin-qt.cpp \
|
||||
qt/test/apptests.cpp \
|
||||
qt/test/optiontests.cpp \
|
||||
qt/test/rpcnestedtests.cpp \
|
||||
qt/test/test_main.cpp \
|
||||
qt/test/uritests.cpp \
|
||||
|
||||
31
src/qt/test/optiontests.cpp
Normal file
31
src/qt/test/optiontests.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2018 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <qt/bitcoin.h>
|
||||
#include <qt/test/optiontests.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/system.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QTest>
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
//! Entry point for BitcoinApplication tests.
|
||||
void OptionTests::optionTests()
|
||||
{
|
||||
// Test regression https://github.com/bitcoin/bitcoin/issues/24457. Ensure
|
||||
// that setting integer prune value doesn't cause an exception to be thrown
|
||||
// in the OptionsModel constructor
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
settings.forced_settings.erase("prune");
|
||||
settings.rw_settings["prune"] = 3814;
|
||||
});
|
||||
gArgs.WriteSettingsFile();
|
||||
OptionsModel{};
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
settings.rw_settings.erase("prune");
|
||||
});
|
||||
gArgs.WriteSettingsFile();
|
||||
}
|
||||
25
src/qt/test/optiontests.h
Normal file
25
src/qt/test/optiontests.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 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.
|
||||
|
||||
#ifndef BITCOIN_QT_TEST_OPTIONTESTS_H
|
||||
#define BITCOIN_QT_TEST_OPTIONTESTS_H
|
||||
|
||||
#include <qt/optionsmodel.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class OptionTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OptionTests(interfaces::Node& node) : m_node(node) {}
|
||||
|
||||
private Q_SLOTS:
|
||||
void optionTests();
|
||||
|
||||
private:
|
||||
interfaces::Node& m_node;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_TEST_OPTIONTESTS_H
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <interfaces/node.h>
|
||||
#include <qt/bitcoin.h>
|
||||
#include <qt/test/apptests.h>
|
||||
#include <qt/test/optiontests.h>
|
||||
#include <qt/test/rpcnestedtests.h>
|
||||
#include <qt/test/uritests.h>
|
||||
#include <test/util/setup_common.h>
|
||||
@@ -89,6 +90,10 @@ int main(int argc, char* argv[])
|
||||
if (QTest::qExec(&app_tests) != 0) {
|
||||
fInvalid = true;
|
||||
}
|
||||
OptionTests options_tests(app.node());
|
||||
if (QTest::qExec(&options_tests) != 0) {
|
||||
fInvalid = true;
|
||||
}
|
||||
URITests test1;
|
||||
if (QTest::qExec(&test1) != 0) {
|
||||
fInvalid = true;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
#include <univalue.h>
|
||||
#include <util/settings.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
|
||||
@@ -41,6 +43,116 @@ void SetupArgs(ArgsManager& local_args, const std::vector<std::pair<std::string,
|
||||
}
|
||||
}
|
||||
|
||||
// Test behavior of GetArg functions when string, integer, and boolean types
|
||||
// are specified in the settings.json file. GetArg functions are convenience
|
||||
// functions. The GetSetting method can always be used instead of GetArg
|
||||
// methods to retrieve original values, and there's not always an objective
|
||||
// answer to what GetArg behavior is best in every case. This test makes sure
|
||||
// there's test coverage for whatever the current behavior is, so it's not
|
||||
// broken or changed unintentionally.
|
||||
BOOST_AUTO_TEST_CASE(setting_args)
|
||||
{
|
||||
ArgsManager args;
|
||||
SetupArgs(args, {{"-foo", ArgsManager::ALLOW_ANY}});
|
||||
|
||||
auto set_foo = [&](const util::SettingsValue& value) {
|
||||
args.LockSettings([&](util::Settings& settings) {
|
||||
settings.rw_settings["foo"] = value;
|
||||
});
|
||||
};
|
||||
|
||||
set_foo("str");
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "\"str\"");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "str");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), false);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), false);
|
||||
|
||||
set_foo("99");
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "\"99\"");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "99");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 99);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), true);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), true);
|
||||
|
||||
set_foo("3.25");
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "\"3.25\"");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "3.25");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 3);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), true);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), true);
|
||||
|
||||
set_foo("0");
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "\"0\"");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "0");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), false);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), false);
|
||||
|
||||
set_foo("");
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "\"\"");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), true);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), true);
|
||||
|
||||
set_foo(99);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "99");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "99");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 99);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error);
|
||||
|
||||
set_foo(3.25);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "3.25");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "3.25");
|
||||
BOOST_CHECK_THROW(args.GetIntArg("foo", 100), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error);
|
||||
|
||||
set_foo(0);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "0");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "0");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error);
|
||||
|
||||
set_foo(true);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "true");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "1");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 1);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), true);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), true);
|
||||
|
||||
set_foo(false);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "false");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "0");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), false);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), false);
|
||||
|
||||
set_foo(UniValue::VOBJ);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "{}");
|
||||
BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetIntArg("foo", 100), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error);
|
||||
|
||||
set_foo(UniValue::VARR);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "[]");
|
||||
BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetIntArg("foo", 100), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error);
|
||||
BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error);
|
||||
|
||||
set_foo(UniValue::VNULL);
|
||||
BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "null");
|
||||
BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "default");
|
||||
BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 100);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", true), true);
|
||||
BOOST_CHECK_EQUAL(args.GetBoolArg("foo", false), false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(boolarg)
|
||||
{
|
||||
ArgsManager local_args;
|
||||
|
||||
@@ -588,7 +588,7 @@ bool ArgsManager::IsArgNegated(const std::string& strArg) const
|
||||
std::string ArgsManager::GetArg(const std::string& strArg, const std::string& strDefault) const
|
||||
{
|
||||
const util::SettingsValue value = GetSetting(strArg);
|
||||
return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str();
|
||||
return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.isNum() ? value.getValStr() : value.get_str();
|
||||
}
|
||||
|
||||
int64_t ArgsManager::GetIntArg(const std::string& strArg, int64_t nDefault) const
|
||||
|
||||
Reference in New Issue
Block a user