Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,8 @@ src/qt/forms/ui_*.h | |
|
||
src/qt/test/moc*.cpp | ||
|
||
Makefile.am.user | ||
|
||
.deps | ||
.dirstamp | ||
.libs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include "unlimited.h" | ||
|
||
#include "test/test_bitcoin.h" | ||
|
||
#include <boost/algorithm/string.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/lexical_cast.hpp> | ||
|
||
using namespace std; | ||
using namespace json_spirit; | ||
|
||
extern Value CallRPC(string args); | ||
|
||
BOOST_FIXTURE_TEST_SUITE(excessiveblock_test, TestingSetup) | ||
|
||
BOOST_AUTO_TEST_CASE(rpc_excessive) | ||
{ | ||
BOOST_CHECK_NO_THROW(CallRPC("getexcessiveblock")); | ||
|
||
BOOST_CHECK_NO_THROW(CallRPC("getminingmaxblock")); | ||
|
||
BOOST_CHECK_THROW(CallRPC("setexcessiveblock not_uint"), runtime_error); | ||
BOOST_CHECK_THROW(CallRPC("setexcessiveblock 0 not_uint"), boost::bad_lexical_cast); | ||
BOOST_CHECK_THROW(CallRPC("setexcessiveblock 0 -1"), boost::bad_lexical_cast); | ||
BOOST_CHECK_THROW(CallRPC("setexcessiveblock -1 0"), boost::bad_lexical_cast); | ||
BOOST_CHECK_NO_THROW(CallRPC("setexcessiveblock 0 0")); | ||
BOOST_CHECK_THROW(CallRPC("setexcessiveblock 0 0 0"), runtime_error); | ||
|
||
BOOST_CHECK_THROW(CallRPC("setminingmaxblock"), runtime_error); | ||
BOOST_CHECK_NO_THROW(CallRPC("setminingmaxblock 100000")); | ||
BOOST_CHECK_THROW(CallRPC("setminingmaxblock not_uint"), boost::bad_lexical_cast); | ||
BOOST_CHECK_THROW(CallRPC("setminingmaxblock -1"), boost::bad_lexical_cast); | ||
BOOST_CHECK_THROW(CallRPC("setminingmaxblock 0"), runtime_error); | ||
BOOST_CHECK_THROW(CallRPC("setminingmaxblock 0 0"), runtime_error); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE(buip005) | ||
{ | ||
string exceptedEB; | ||
string exceptedAD; | ||
excessiveBlockSize = 1000000; | ||
excessiveAcceptDepth = 9999999; | ||
exceptedEB = "EB1"; | ||
exceptedAD = "AD9999999"; | ||
settingsToUserAgentString(); | ||
BOOST_CHECK_MESSAGE(BUComments.front() == exceptedEB, | ||
"EB ought to have been " << exceptedEB << " when excessiveBlockSize = " | ||
<< excessiveBlockSize << " but was " << BUComments.front()); | ||
BOOST_CHECK_MESSAGE(BUComments.back() == exceptedAD, | ||
"AD ought to have been " << exceptedAD << " when excessiveBlockSize = " << excessiveAcceptDepth); | ||
excessiveBlockSize = 100000; | ||
excessiveAcceptDepth = 9999999 + 1; | ||
exceptedEB = "EB0.1"; | ||
exceptedAD = "AD9999999"; | ||
settingsToUserAgentString(); | ||
BOOST_CHECK_MESSAGE(BUComments.front() == exceptedEB, | ||
"EB ought to have been " << exceptedEB << " when excessiveBlockSize = " | ||
<< excessiveBlockSize << " but was " << BUComments.front()); | ||
BOOST_CHECK_MESSAGE(BUComments.back() == exceptedAD, | ||
"AD ought to have been " << exceptedAD << " when excessiveBlockSize = " << excessiveAcceptDepth); | ||
excessiveBlockSize = 10000; | ||
exceptedEB = "EB0"; | ||
settingsToUserAgentString(); | ||
BOOST_CHECK_MESSAGE(BUComments.front() == exceptedEB, | ||
"EB ought to have been " << exceptedEB << " when excessiveBlockSize = " | ||
<< excessiveBlockSize << " but was " << BUComments.front()); | ||
excessiveBlockSize = 150000; | ||
exceptedEB = "EB0.1"; | ||
settingsToUserAgentString(); | ||
BOOST_CHECK_MESSAGE(BUComments.front() == exceptedEB, | ||
"EB ought to have been rounded to " << exceptedEB << " when excessiveBlockSize = " | ||
<< excessiveBlockSize << " but was " << BUComments.front()); | ||
excessiveBlockSize = 150000; | ||
exceptedEB = "EB0.1"; | ||
settingsToUserAgentString(); | ||
BOOST_CHECK_MESSAGE(BUComments.front() == exceptedEB, | ||
"EB ought to have been rounded to " << exceptedEB << " when excessiveBlockSize = " | ||
<< excessiveBlockSize << " but was " << BUComments.front()); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters