Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
//
|
||||
// Unit tests for block-chain checkpoints
|
||||
//
|
||||
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "../checkpoints.h"
|
||||
#include "../util.h"
|
||||
#include "checkpoints.h"
|
||||
|
||||
#include "uint256.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
//
|
||||
// Unit tests for denial-of-service detection/prevention code
|
||||
//
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
||||
#include "bignum.h"
|
||||
#include "keystore.h"
|
||||
#include "main.h"
|
||||
#include "net.h"
|
||||
#include "script.h"
|
||||
#include "serialize.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
#include "net.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
// Tests this internal-to-main.cpp method:
|
||||
extern bool AddOrphanTx(const CTransaction& tx);
|
||||
@@ -67,7 +69,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
||||
BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
{
|
||||
CNode::ClearBanned();
|
||||
int64 nStartTime = GetTime();
|
||||
int64_t nStartTime = GetTime();
|
||||
SetMockTime(nStartTime); // Overrides future calls to GetTime()
|
||||
|
||||
CAddress addr(ip(0xa0b0c001));
|
||||
@@ -83,11 +85,11 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
BOOST_CHECK(!CNode::IsBanned(addr));
|
||||
}
|
||||
|
||||
static bool CheckNBits(unsigned int nbits1, int64 time1, unsigned int nbits2, int64 time2)\
|
||||
static bool CheckNBits(unsigned int nbits1, int64_t time1, unsigned int nbits2, int64_t time2)\
|
||||
{
|
||||
if (time1 > time2)
|
||||
return CheckNBits(nbits2, time2, nbits1, time1);
|
||||
int64 deltaTime = time2-time1;
|
||||
int64_t deltaTime = time2-time1;
|
||||
|
||||
CBigNum required;
|
||||
required.SetCompact(ComputeMinWork(nbits1, deltaTime));
|
||||
@@ -102,7 +104,7 @@ BOOST_AUTO_TEST_CASE(DoS_checknbits)
|
||||
|
||||
// Timestamps,nBits from the bitcoin block chain.
|
||||
// These are the block-chain checkpoint blocks
|
||||
typedef std::map<int64, unsigned int> BlockData;
|
||||
typedef std::map<int64_t, unsigned int> BlockData;
|
||||
BlockData chainData =
|
||||
map_list_of(1239852051,486604799)(1262749024,486594666)
|
||||
(1279305360,469854461)(1280200847,469830746)(1281678674,469809688)
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "init.h"
|
||||
#include "wallet.h"
|
||||
#include "walletdb.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
extern CWallet* pwalletMain;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(accounting_tests)
|
||||
|
||||
static void
|
||||
GetResults(CWalletDB& walletdb, std::map<int64, CAccountingEntry>& results)
|
||||
GetResults(CWalletDB& walletdb, std::map<int64_t, CAccountingEntry>& results)
|
||||
{
|
||||
std::list<CAccountingEntry> aes;
|
||||
|
||||
@@ -28,7 +32,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
|
||||
std::vector<CWalletTx*> vpwtx;
|
||||
CWalletTx wtx;
|
||||
CAccountingEntry ae;
|
||||
std::map<int64, CAccountingEntry> results;
|
||||
std::map<int64_t, CAccountingEntry> results;
|
||||
|
||||
ae.strAccount = "";
|
||||
ae.nCreditDebit = 1;
|
||||
|
||||
@@ -2,14 +2,18 @@
|
||||
// Unit tests for alert system
|
||||
//
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <fstream>
|
||||
|
||||
#include "alert.h"
|
||||
#include "data/alertTests.raw.h"
|
||||
|
||||
#include "serialize.h"
|
||||
#include "util.h"
|
||||
#include "data/alertTests.raw.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#if 0
|
||||
//
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "init.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(allocator_tests)
|
||||
|
||||
// Dummy memory page locker for platform independent tests
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(base32_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(base32_testvectors)
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "json/json_spirit_reader_template.h"
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
#include "json/json_spirit_utils.h"
|
||||
#include "base58.h"
|
||||
|
||||
#include "data/base58_encode_decode.json.h"
|
||||
#include "data/base58_keys_invalid.json.h"
|
||||
#include "data/base58_keys_valid.json.h"
|
||||
|
||||
#include "base58.h"
|
||||
#include "key.h"
|
||||
#include "script.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "json/json_spirit_reader_template.h"
|
||||
#include "json/json_spirit_utils.h"
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
|
||||
using namespace json_spirit;
|
||||
extern Array read_json(const std::string& jsondata);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(base64_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(base64_testvectors)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <limits>
|
||||
|
||||
#include "bignum.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(bignum_tests)
|
||||
|
||||
@@ -46,7 +47,7 @@ BOOST_AUTO_TEST_SUITE(bignum_tests)
|
||||
// Let's force this code not to be inlined, in order to actually
|
||||
// test a generic version of the function. This increases the chance
|
||||
// that -ftrapv will detect overflows.
|
||||
NOINLINE void mysetint64(CBigNum& num, int64 n)
|
||||
NOINLINE void mysetint64(CBigNum& num, int64_t n)
|
||||
{
|
||||
num.setint64(n);
|
||||
}
|
||||
@@ -55,7 +56,7 @@ NOINLINE void mysetint64(CBigNum& num, int64 n)
|
||||
// value to 0, then the second one with a non-inlined function.
|
||||
BOOST_AUTO_TEST_CASE(bignum_setint64)
|
||||
{
|
||||
int64 n;
|
||||
int64_t n;
|
||||
|
||||
{
|
||||
n = 0;
|
||||
@@ -103,7 +104,7 @@ BOOST_AUTO_TEST_CASE(bignum_setint64)
|
||||
BOOST_CHECK(num.ToString() == "-5");
|
||||
}
|
||||
{
|
||||
n = std::numeric_limits<int64>::min();
|
||||
n = std::numeric_limits<int64_t>::min();
|
||||
CBigNum num(n);
|
||||
BOOST_CHECK(num.ToString() == "-9223372036854775808");
|
||||
num.setulong(0);
|
||||
@@ -112,7 +113,7 @@ BOOST_AUTO_TEST_CASE(bignum_setint64)
|
||||
BOOST_CHECK(num.ToString() == "-9223372036854775808");
|
||||
}
|
||||
{
|
||||
n = std::numeric_limits<int64>::max();
|
||||
n = std::numeric_limits<int64_t>::max();
|
||||
CBigNum num(n);
|
||||
BOOST_CHECK(num.ToString() == "9223372036854775807");
|
||||
num.setulong(0);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "base58.h"
|
||||
#include "key.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "key.h"
|
||||
#include "base58.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
struct TestDerivation {
|
||||
std::string pub;
|
||||
std::string prv;
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "bloom.h"
|
||||
|
||||
#include "base58.h"
|
||||
#include "key.h"
|
||||
#include "main.h"
|
||||
#include "serialize.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "bloom.h"
|
||||
#include "util.h"
|
||||
#include "key.h"
|
||||
#include "base58.h"
|
||||
#include "main.h"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::tuples;
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
//
|
||||
// Unit tests for canonical signatures
|
||||
//
|
||||
|
||||
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <openssl/ecdsa.h>
|
||||
|
||||
#include "key.h"
|
||||
#include "script.h"
|
||||
#include "util.h"
|
||||
#include "data/sig_noncanonical.json.h"
|
||||
#include "data/sig_canonical.json.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
#include <openssl/ecdsa.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
//
|
||||
// Unit tests for block.CheckBlock()
|
||||
//
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
#include "net.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(CheckBlock_tests)
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
// amounts 0.00000001 .. 0.00100000
|
||||
#define NUM_MULTIPLES_UNIT 100000
|
||||
@@ -17,19 +19,17 @@
|
||||
// amounts 50 .. 21000000
|
||||
#define NUM_MULTIPLES_50BTC 420000
|
||||
|
||||
using namespace std;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(compress_tests)
|
||||
|
||||
bool static TestEncode(uint64 in) {
|
||||
bool static TestEncode(uint64_t in) {
|
||||
return in == CTxOutCompressor::DecompressAmount(CTxOutCompressor::CompressAmount(in));
|
||||
}
|
||||
|
||||
bool static TestDecode(uint64 in) {
|
||||
bool static TestDecode(uint64_t in) {
|
||||
return in == CTxOutCompressor::CompressAmount(CTxOutCompressor::DecompressAmount(in));
|
||||
}
|
||||
|
||||
bool static TestPair(uint64 dec, uint64 enc) {
|
||||
bool static TestPair(uint64_t dec, uint64_t enc) {
|
||||
return CTxOutCompressor::CompressAmount(dec) == enc &&
|
||||
CTxOutCompressor::DecompressAmount(enc) == dec;
|
||||
}
|
||||
@@ -43,19 +43,19 @@ BOOST_AUTO_TEST_CASE(compress_amounts)
|
||||
BOOST_CHECK(TestPair( 50*COIN, 0x32));
|
||||
BOOST_CHECK(TestPair(21000000*COIN, 0x1406f40));
|
||||
|
||||
for (uint64 i = 1; i <= NUM_MULTIPLES_UNIT; i++)
|
||||
for (uint64_t i = 1; i <= NUM_MULTIPLES_UNIT; i++)
|
||||
BOOST_CHECK(TestEncode(i));
|
||||
|
||||
for (uint64 i = 1; i <= NUM_MULTIPLES_CENT; i++)
|
||||
for (uint64_t i = 1; i <= NUM_MULTIPLES_CENT; i++)
|
||||
BOOST_CHECK(TestEncode(i * CENT));
|
||||
|
||||
for (uint64 i = 1; i <= NUM_MULTIPLES_1BTC; i++)
|
||||
for (uint64_t i = 1; i <= NUM_MULTIPLES_1BTC; i++)
|
||||
BOOST_CHECK(TestEncode(i * COIN));
|
||||
|
||||
for (uint64 i = 1; i <= NUM_MULTIPLES_50BTC; i++)
|
||||
for (uint64_t i = 1; i <= NUM_MULTIPLES_50BTC; i++)
|
||||
BOOST_CHECK(TestEncode(i * 50 * COIN));
|
||||
|
||||
for (uint64 i = 0; i < 100000; i++)
|
||||
for (uint64_t i = 0; i < 100000; i++)
|
||||
BOOST_CHECK(TestDecode(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(getarg_tests)
|
||||
|
||||
static void ResetArgs(const std::string& strArg)
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
#include "hash.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "util.h"
|
||||
#include "hash.h"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
#include "hash.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(hmac_tests)
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "key.h"
|
||||
|
||||
#include "base58.h"
|
||||
#include "script.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "key.h"
|
||||
#include "base58.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "init.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "miner.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
#include "miner.h"
|
||||
#include "wallet.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
extern CWallet* pwalletMain;
|
||||
extern void SHA256Transform(void* pstate, void* pinput, const void* pinit);
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(miner_tests)
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "mruset.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#define NUM_TESTS 16
|
||||
#define MAX_SIZE 100
|
||||
|
||||
using namespace std;
|
||||
|
||||
class mrutester
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
#include <boost/assign/std/vector.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#include "key.h"
|
||||
#include "keystore.h"
|
||||
#include "main.h"
|
||||
#include "script.h"
|
||||
#include "wallet.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#include <boost/assign/std/vector.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::assign;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "netbase.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "netbase.h"
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "uint256.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "serialize.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "bitcoinrpc.h"
|
||||
|
||||
#include "base58.h"
|
||||
#include "util.h"
|
||||
#include "bitcoinrpc.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/assign/list_inserter.hpp>
|
||||
#include <boost/assign/std/vector.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include "script.h"
|
||||
|
||||
#include "../main.h"
|
||||
#include "../script.h"
|
||||
#include "../wallet.h"
|
||||
#include "key.h"
|
||||
#include "keystore.h"
|
||||
#include "main.h"
|
||||
#include "script.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
#include <iostream>
|
||||
#include "script.h"
|
||||
|
||||
#include "data/script_invalid.json.h"
|
||||
#include "data/script_valid.json.h"
|
||||
|
||||
#include "key.h"
|
||||
#include "keystore.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "json/json_spirit_reader_template.h"
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
#include "json/json_spirit_utils.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
#include "data/script_invalid.json.h"
|
||||
#include "data/script_valid.json.h"
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
@@ -60,7 +67,7 @@ ParseScript(string s)
|
||||
(starts_with(w, "-") && all(string(w.begin()+1, w.end()), is_digit())))
|
||||
{
|
||||
// Number
|
||||
int64 n = atoi64(w);
|
||||
int64_t n = atoi64(w);
|
||||
result << n;
|
||||
}
|
||||
else if (starts_with(w, "0x") && IsHex(string(w.begin()+2, w.end())))
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "serialize.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(serialize_tests)
|
||||
@@ -21,7 +20,7 @@ BOOST_AUTO_TEST_CASE(varints)
|
||||
BOOST_CHECK(size == ss.size());
|
||||
}
|
||||
|
||||
for (uint64 i = 0; i < 100000000000ULL; i += 999999937) {
|
||||
for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) {
|
||||
ss << VARINT(i);
|
||||
size += ::GetSerializeSize(VARINT(i), 0, 0);
|
||||
BOOST_CHECK(size == ss.size());
|
||||
@@ -34,8 +33,8 @@ BOOST_AUTO_TEST_CASE(varints)
|
||||
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
|
||||
}
|
||||
|
||||
for (uint64 i = 0; i < 100000000000ULL; i += 999999937) {
|
||||
uint64 j = -1;
|
||||
for (uint64_t i = 0; i < 100000000000ULL; i += 999999937) {
|
||||
uint64_t j = -1;
|
||||
ss >> VARINT(j);
|
||||
BOOST_CHECK_MESSAGE(i == j, "decoded:" << j << " expected:" << i);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#include <vector>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "script.h"
|
||||
|
||||
#include "key.h"
|
||||
#include "script.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
#define BOOST_TEST_MODULE Bitcoin Test Suite
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
|
||||
|
||||
#include "db.h"
|
||||
#include "txdb.h"
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
#include "txdb.h"
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
#include "wallet.h"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
CWallet* pwalletMain;
|
||||
CClientUIInterface uiInterface;
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
|
||||
#include "data/tx_invalid.json.h"
|
||||
#include "data/tx_valid.json.h"
|
||||
|
||||
#include "key.h"
|
||||
#include "keystore.h"
|
||||
#include "main.h"
|
||||
#include "script.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include "json/json_spirit_writer_template.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "uint256.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(uint160_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(uint160_equality)
|
||||
@@ -10,7 +12,7 @@ BOOST_AUTO_TEST_CASE(uint160_equality)
|
||||
uint160 num2 = 11;
|
||||
BOOST_CHECK(num1+1 == num2);
|
||||
|
||||
uint64 num3 = 10;
|
||||
uint64_t num3 = 10;
|
||||
BOOST_CHECK(num1 == num3);
|
||||
BOOST_CHECK(num1+num2 == num3+num2);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "uint256.h"
|
||||
#include <string>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(uint256_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(uint256_equality)
|
||||
@@ -11,7 +13,7 @@ BOOST_AUTO_TEST_CASE(uint256_equality)
|
||||
uint256 num2 = 11;
|
||||
BOOST_CHECK(num1+1 == num2);
|
||||
|
||||
uint64 num3 = 10;
|
||||
uint64_t num3 = 10;
|
||||
BOOST_CHECK(num1 == num3);
|
||||
BOOST_CHECK(num1+num2 == num3+num2);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include <vector>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "sync.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(util_tests)
|
||||
@@ -200,7 +201,7 @@ BOOST_AUTO_TEST_CASE(util_FormatMoney)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(util_ParseMoney)
|
||||
{
|
||||
int64 ret = 0;
|
||||
int64_t ret = 0;
|
||||
BOOST_CHECK(ParseMoney("0.0", ret));
|
||||
BOOST_CHECK_EQUAL(ret, 0);
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "main.h"
|
||||
#include "wallet.h"
|
||||
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
// how many times to run all the tests to have a chance to catch errors that only show up with particular random shuffles
|
||||
#define RUN_TESTS 100
|
||||
|
||||
@@ -19,7 +24,7 @@ BOOST_AUTO_TEST_SUITE(wallet_tests)
|
||||
static CWallet wallet;
|
||||
static vector<COutput> vCoins;
|
||||
|
||||
static void add_coin(int64 nValue, int nAge = 6*24, bool fIsFromMe = false, int nInput=0)
|
||||
static void add_coin(int64_t nValue, int nAge = 6*24, bool fIsFromMe = false, int nInput=0)
|
||||
{
|
||||
static int nextLockTime = 0;
|
||||
CTransaction tx;
|
||||
@@ -55,7 +60,7 @@ static bool equal_sets(CoinSet a, CoinSet b)
|
||||
BOOST_AUTO_TEST_CASE(coin_selection_tests)
|
||||
{
|
||||
CoinSet setCoinsRet, setCoinsRet2;
|
||||
int64 nValueRet;
|
||||
int64_t nValueRet;
|
||||
|
||||
// test multiple times to allow for differences in the shuffle order
|
||||
for (int i = 0; i < RUN_TESTS; i++)
|
||||
|
||||
Reference in New Issue
Block a user