3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
5
5
#include " wallet/wallet.h"
6
- #include " wallet/walletdb.h"
7
6
8
7
#include " wallet/test/wallet_test_fixture.h"
9
8
@@ -17,13 +16,13 @@ extern CWallet* pwalletMain;
17
16
BOOST_FIXTURE_TEST_SUITE (accounting_tests, WalletTestingSetup)
18
17
19
18
static void
20
- GetResults(CWalletDB& walletdb, std::map<CAmount, CAccountingEntry>& results)
19
+ GetResults(std::map<CAmount, CAccountingEntry>& results)
21
20
{
22
21
std::list<CAccountingEntry> aes;
23
22
24
23
results.clear ();
25
- BOOST_CHECK (walletdb. ReorderTransactions (pwalletMain ) == DB_LOAD_OK);
26
- walletdb. ListAccountCreditDebit (" " , aes);
24
+ BOOST_CHECK (pwalletMain-> ReorderTransactions () == DB_LOAD_OK);
25
+ pwalletMain-> ListAccountCreditDebit (" " , aes);
27
26
BOOST_FOREACH (CAccountingEntry& ae, aes)
28
27
{
29
28
results[ae.nOrderPos ] = ae;
@@ -32,7 +31,6 @@ GetResults(CWalletDB& walletdb, std::map<CAmount, CAccountingEntry>& results)
32
31
33
32
BOOST_AUTO_TEST_CASE (acc_orderupgrade)
34
33
{
35
- CWalletDB walletdb (pwalletMain->strWalletFile );
36
34
std::vector<CWalletTx*> vpwtx;
37
35
CWalletTx wtx;
38
36
CAccountingEntry ae;
@@ -45,7 +43,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
45
43
ae.nTime = 1333333333 ;
46
44
ae.strOtherAccount = " b" ;
47
45
ae.strComment = " " ;
48
- pwalletMain->AddAccountingEntry (ae, walletdb );
46
+ pwalletMain->AddAccountingEntry (ae);
49
47
50
48
wtx.mapValue [" comment" ] = " z" ;
51
49
pwalletMain->AddToWallet (wtx);
@@ -55,9 +53,9 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
55
53
56
54
ae.nTime = 1333333336 ;
57
55
ae.strOtherAccount = " c" ;
58
- pwalletMain->AddAccountingEntry (ae, walletdb );
56
+ pwalletMain->AddAccountingEntry (ae);
59
57
60
- GetResults (walletdb, results);
58
+ GetResults (results);
61
59
62
60
BOOST_CHECK (pwalletMain->nOrderPosNext == 3 );
63
61
BOOST_CHECK (2 == results.size ());
@@ -71,9 +69,9 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
71
69
ae.nTime = 1333333330 ;
72
70
ae.strOtherAccount = " d" ;
73
71
ae.nOrderPos = pwalletMain->IncOrderPosNext ();
74
- pwalletMain->AddAccountingEntry (ae, walletdb );
72
+ pwalletMain->AddAccountingEntry (ae);
75
73
76
- GetResults (walletdb, results);
74
+ GetResults (results);
77
75
78
76
BOOST_CHECK (results.size () == 3 );
79
77
BOOST_CHECK (pwalletMain->nOrderPosNext == 4 );
@@ -105,7 +103,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
105
103
vpwtx[2 ]->nTimeReceived = (unsigned int )1333333329 ;
106
104
vpwtx[2 ]->nOrderPos = -1 ;
107
105
108
- GetResults (walletdb, results);
106
+ GetResults (results);
109
107
110
108
BOOST_CHECK (results.size () == 3 );
111
109
BOOST_CHECK (pwalletMain->nOrderPosNext == 6 );
@@ -121,9 +119,9 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
121
119
ae.nTime = 1333333334 ;
122
120
ae.strOtherAccount = " e" ;
123
121
ae.nOrderPos = -1 ;
124
- pwalletMain->AddAccountingEntry (ae, walletdb );
122
+ pwalletMain->AddAccountingEntry (ae);
125
123
126
- GetResults (walletdb, results);
124
+ GetResults (results);
127
125
128
126
BOOST_CHECK (results.size () == 4 );
129
127
BOOST_CHECK (pwalletMain->nOrderPosNext == 7 );
0 commit comments