diff options
Diffstat (limited to 'src/test')
34 files changed, 247 insertions, 173 deletions
diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp index b14e9f7057..78b0236b74 100644 --- a/src/test/Checkpoints_tests.cpp +++ b/src/test/Checkpoints_tests.cpp @@ -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; diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index c7f968da7c..f0fb84bc54 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -1,21 +1,23 @@ // // Unit tests for denial-of-service detection/prevention code // -#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 "chainparams.h" + +#include "bignum.h" +#include "keystore.h" #include "main.h" -#include "wallet.h" #include "net.h" -#include "util.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/foreach.hpp> +#include <boost/test/unit_test.hpp> + // Tests this internal-to-main.cpp method: extern bool AddOrphanTx(const CTransaction& tx); extern unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans); @@ -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) diff --git a/src/test/accounting_tests.cpp b/src/test/accounting_tests.cpp index 8ac657288b..5f79436e48 100644 --- a/src/test/accounting_tests.cpp +++ b/src/test/accounting_tests.cpp @@ -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; diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index cb941943f7..adfbec9dec 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -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 // diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp index d5cb8e8101..490dff87e5 100644 --- a/src/test/allocator_tests.cpp +++ b/src/test/allocator_tests.cpp @@ -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 diff --git a/src/test/base32_tests.cpp b/src/test/base32_tests.cpp index fdf3285913..580e87f65f 100644 --- a/src/test/base32_tests.cpp +++ b/src/test/base32_tests.cpp @@ -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) diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index 05675685bd..84db99d816 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -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); diff --git a/src/test/base64_tests.cpp b/src/test/base64_tests.cpp index c5a053e2eb..c59c290669 100644 --- a/src/test/base64_tests.cpp +++ b/src/test/base64_tests.cpp @@ -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) diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp index f16c26fd18..9d67324c76 100644 --- a/src/test/bignum_tests.cpp +++ b/src/test/bignum_tests.cpp @@ -1,8 +1,9 @@ -#include <boost/test/unit_test.hpp> +#include "bignum.h" + #include <limits> +#include <stdint.h> -#include "bignum.h" -#include "util.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); diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp index 66d2330fbf..2bcca24336 100644 --- a/src/test/bip32_tests.cpp +++ b/src/test/bip32_tests.cpp @@ -1,13 +1,13 @@ #include <boost/test/unit_test.hpp> -#include <string> -#include <vector> - -#include "key.h" #include "base58.h" +#include "key.h" #include "uint256.h" #include "util.h" +#include <string> +#include <vector> + struct TestDerivation { std::string pub; std::string prv; diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index 0d349a990c..c4e4403b70 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -1,11 +1,15 @@ -#include <boost/test/unit_test.hpp> -#include <vector> - #include "bloom.h" -#include "util.h" -#include "key.h" + #include "base58.h" +#include "key.h" #include "main.h" +#include "serialize.h" +#include "uint256.h" +#include "util.h" + +#include <vector> + +#include <boost/test/unit_test.hpp> using namespace std; using namespace boost::tuples; diff --git a/src/test/canonical_tests.cpp b/src/test/canonical_tests.cpp index ec32ceb8a4..c521f2cf9c 100644 --- a/src/test/canonical_tests.cpp +++ b/src/test/canonical_tests.cpp @@ -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; diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp index e34680db99..d47a33fd46 100644 --- a/src/test/checkblock_tests.cpp +++ b/src/test/checkblock_tests.cpp @@ -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) diff --git a/src/test/compress_tests.cpp b/src/test/compress_tests.cpp index 71b86bcb41..4d16914774 100644 --- a/src/test/compress_tests.cpp +++ b/src/test/compress_tests.cpp @@ -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)); } diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index c89d218f80..d76124885b 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -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) diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp index d69cfd706d..28410f0fed 100644 --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -1,8 +1,11 @@ -#include <boost/test/unit_test.hpp> -#include <vector> -#include "util.h" + #include "hash.h" +#include "util.h" + +#include <vector> + +#include <boost/test/unit_test.hpp> using namespace std; diff --git a/src/test/hmac_tests.cpp b/src/test/hmac_tests.cpp index 92ca5e6aff..68868866aa 100644 --- a/src/test/hmac_tests.cpp +++ b/src/test/hmac_tests.cpp @@ -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) diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index c004521d1a..421ffeac45 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -1,13 +1,15 @@ -#include <boost/test/unit_test.hpp> - -#include <string> -#include <vector> - #include "key.h" + #include "base58.h" +#include "script.h" #include "uint256.h" #include "util.h" +#include <string> +#include <vector> + +#include <boost/test/unit_test.hpp> + using namespace std; static const string strSecret1 ("5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj"); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 67165760b2..dcb7f9abd4 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -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) diff --git a/src/test/mruset_tests.cpp b/src/test/mruset_tests.cpp index 64a6678a73..638c88fabe 100644 --- a/src/test/mruset_tests.cpp +++ b/src/test/mruset_tests.cpp @@ -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: diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp index 05309f1a4d..772217b888 100644 --- a/src/test/multisig_tests.cpp +++ b/src/test/multisig_tests.cpp @@ -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; diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index e5a7562d97..412ba04910 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -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; diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp index cf09421617..dea5e1b824 100644 --- a/src/test/pmt_tests.cpp +++ b/src/test/pmt_tests.cpp @@ -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; diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 25849054eb..4fb2aeb6ae 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -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; diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp index 3c666d2842..e57dc9bbba 100644 --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -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 "key.h" +#include "keystore.h" +#include "main.h" +#include "script.h" -#include "../main.h" -#include "../script.h" -#include "../wallet.h" +#include <vector> + +#include <boost/test/unit_test.hpp> using namespace std; diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 32be914414..dee0f110ad 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -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()))) diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp index 7e193c88ce..afcdd118bc 100644 --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -1,9 +1,8 @@ -#include <boost/test/unit_test.hpp> +#include "serialize.h" -#include <string> -#include <vector> +#include <stdint.h> -#include "serialize.h" +#include <boost/test/unit_test.hpp> using namespace std; @@ -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); } diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index 5a87f17600..96f663ccef 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -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; diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 1bf9a28acc..f947167597 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -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; diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index bd999caa14..ad33184bc5 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -1,13 +1,19 @@ + + +#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" -#include "main.h" -#include "wallet.h" -#include "data/tx_invalid.json.h" -#include "data/tx_valid.json.h" - using namespace std; using namespace json_spirit; diff --git a/src/test/uint160_tests.cpp b/src/test/uint160_tests.cpp index 35cb35b25a..87418fabec 100644 --- a/src/test/uint160_tests.cpp +++ b/src/test/uint160_tests.cpp @@ -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); } diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp index e34efcc47e..188635dcbd 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -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); } diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index abfd882655..6a9a787fa6 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -1,10 +1,11 @@ +#include "util.h" + +#include "sync.h" + +#include <stdint.h> #include <vector> -#include <boost/test/unit_test.hpp> -#include <boost/foreach.hpp> -#include "main.h" -#include "wallet.h" -#include "util.h" +#include <boost/test/unit_test.hpp> using namespace std; @@ -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); diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index 51f3b27c8b..0acd94ef36 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -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++) |