@@ -17,8 +17,8 @@ BOOST_AUTO_TEST_CASE(GetBalance) {
17
17
18
18
MyFixture fx;
19
19
20
- BOOST_REQUIRE_NO_THROW (fx.btc .getbalance ());
21
- BOOST_REQUIRE_NO_THROW (fx.btc .getbalance (" " ));
20
+ NO_THROW (fx.btc .getbalance ());
21
+ NO_THROW (fx.btc .getbalance (" " ));
22
22
23
23
#ifdef VERBOSE
24
24
double response = fx.btc .getbalance ();
@@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(GetReceivedByAccount) {
32
32
33
33
MyFixture fx;
34
34
35
- BOOST_REQUIRE_NO_THROW (fx.btc .getreceivedbyaccount (" " ));
35
+ NO_THROW (fx.btc .getreceivedbyaccount (" " ));
36
36
37
37
#ifdef VERBOSE
38
38
double response = fx.btc .getreceivedbyaccount (" " );
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(GetReceivedByAddress) {
47
47
48
48
std::string param = " 36m2bHwsUnkpGsZgVAEmeJRf2CeViDm6RV" ;
49
49
50
- BOOST_REQUIRE_NO_THROW (fx.btc .getreceivedbyaddress (param));
50
+ NO_THROW (fx.btc .getreceivedbyaddress (param));
51
51
52
52
#ifdef VERBOSE
53
53
double response = fx.btc .getreceivedbyaddress (param);
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(ListReceivedByAccount) {
62
62
MyFixture fx;
63
63
64
64
std::vector<accountinfo_t > response;
65
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listreceivedbyaccount (1 ,true ));
65
+ NO_THROW (response = fx.btc .listreceivedbyaccount (1 ,true ));
66
66
67
67
#ifdef VERBOSE
68
68
std::cout << " === listreceivedbyaccount ===" << std::endl;
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(ListReceivedByAddress) {
80
80
MyFixture fx;
81
81
82
82
std::vector<addressinfo_t > response;
83
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listreceivedbyaddress (1 ,true ));
83
+ NO_THROW (response = fx.btc .listreceivedbyaddress (1 ,true ));
84
84
85
85
#ifdef VERBOSE
86
86
std::cout << " === listreceivedbyaccount ===" << std::endl;
@@ -106,12 +106,8 @@ BOOST_AUTO_TEST_CASE(GetTransaction) {
106
106
107
107
std::string txid = " 5a8f750129702d4e0ccd3e6fa91193d8191ea9742a36835b43d3b3c56ad816d1" ;
108
108
gettransaction_t response;
109
- try {
110
- response = fx.btc .gettransaction (txid, false );
111
- } catch (BitcoinException& e) {
112
- BOOST_REQUIRE (e.getCode () == -5 );
113
- return ;
114
- }
109
+
110
+ NO_THROW_EXCEPT (response = fx.btc .gettransaction (txid, false ), -5 );
115
111
116
112
#ifdef VERBOSE
117
113
std::cout << " === gettransaction ===" << std::endl;
@@ -151,7 +147,7 @@ BOOST_AUTO_TEST_CASE(ListTransactions) {
151
147
MyFixture fx;
152
148
153
149
std::vector<transactioninfo_t > response;
154
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listtransactions ());
150
+ NO_THROW (response = fx.btc .listtransactions ());
155
151
156
152
#ifdef VERBOSE
157
153
std::cout << " === listtransactions ===" << std::endl;
@@ -185,14 +181,9 @@ BOOST_AUTO_TEST_CASE(GetAccount) {
185
181
std::string address;
186
182
std::string response;
187
183
188
- try {
189
- address = fx.btc .getnewaddress (" TestUser" );
190
- } catch (BitcoinException& e) {
191
- BOOST_REQUIRE (e.getCode () == -12 );
192
- BOOST_WARN_MESSAGE (false , e.getMessage ());
193
- }
184
+ NO_THROW_EXCEPT (address = fx.btc .getnewaddress (" TestUser" ), -12 );
194
185
195
- BOOST_REQUIRE_NO_THROW (response = fx.btc .getaccount (address));
186
+ NO_THROW (response = fx.btc .getaccount (address));
196
187
BOOST_REQUIRE (response == " TestUser" );
197
188
198
189
#ifdef VERBOSE
@@ -209,16 +200,10 @@ BOOST_AUTO_TEST_CASE(GetAccountAddress) {
209
200
std::string response;
210
201
211
202
/* Unlock wallet and refill the keypool */
212
- try {
213
- fx.btc .walletpassphrase (" 123456" , 10 );
214
- } catch (BitcoinException& e) {
215
- BOOST_REQUIRE (e.getCode () == -14 );
216
- BOOST_WARN_MESSAGE (false , e.getMessage ());
217
- return ;
218
- }
203
+ NO_THROW_EXCEPT (fx.btc .walletpassphrase (" 123456" , 10 ), -14 );
219
204
220
- BOOST_REQUIRE_NO_THROW (fx.btc .keypoolrefill ());
221
- BOOST_REQUIRE_NO_THROW (address = fx.btc .getnewaddress (" TestUser" ));
205
+ NO_THROW (fx.btc .keypoolrefill ());
206
+ NO_THROW (address = fx.btc .getnewaddress (" TestUser" ));
222
207
BOOST_REQUIRE (address.length () >= 27 && address.length () <= 34 );
223
208
224
209
#ifdef VERBOSE
@@ -232,7 +217,7 @@ BOOST_AUTO_TEST_CASE(GetAddressesByAccount) {
232
217
MyFixture fx;
233
218
234
219
std::vector<std::string> response;
235
- BOOST_REQUIRE_NO_THROW (response = fx.btc .getaddressesbyaccount (" TestUser" ));
220
+ NO_THROW (response = fx.btc .getaddressesbyaccount (" TestUser" ));
236
221
BOOST_REQUIRE (response.size () >= 1 );
237
222
238
223
#ifdef VERBOSE
@@ -249,7 +234,7 @@ BOOST_AUTO_TEST_CASE(ListAccounts) {
249
234
MyFixture fx;
250
235
251
236
std::map<std::string, double > response;
252
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listaccounts ());
237
+ NO_THROW (response = fx.btc .listaccounts ());
253
238
254
239
#ifdef VERBOSE
255
240
std::cout << " === listaccounts ===" << std::endl;
@@ -287,8 +272,8 @@ BOOST_AUTO_TEST_CASE(SetAccount) {
287
272
MyFixture fx;
288
273
289
274
std::string address;
290
- BOOST_REQUIRE_NO_THROW (address = fx.btc .getnewaddress (" TestUser" ))
291
- BOOST_REQUIRE_NO_THROW (fx.btc .setaccount (address," TestUser2" ));
275
+ NO_THROW_EXCEPT (address = fx.btc .getnewaddress (" TestUser" ), - 12 );
276
+ NO_THROW (fx.btc .setaccount (address," TestUser2" ));
292
277
}
293
278
294
279
BOOST_AUTO_TEST_CASE (SendToAddress) {
@@ -348,7 +333,7 @@ BOOST_AUTO_TEST_CASE(GetTxOut) {
348
333
std::string txid = " 105d8fd318533d4559492b85a27039f2bf8bdfed39b8e671753289eaeb3829ae" ;
349
334
utxoinfo_t response;
350
335
351
- BOOST_REQUIRE_NO_THROW (response = fx.btc .gettxout (txid, 0 ));
336
+ NO_THROW (response = fx.btc .gettxout (txid, 0 ));
352
337
353
338
#ifdef VERBOSE
354
339
std::cout << " === gettxout ===" << std::endl;
@@ -374,7 +359,7 @@ BOOST_AUTO_TEST_CASE(GetTxOutSetInfo) {
374
359
375
360
utxosetinfo_t response;
376
361
377
- BOOST_REQUIRE_NO_THROW (response = fx.btc .gettxoutsetinfo ());
362
+ NO_THROW (response = fx.btc .gettxoutsetinfo ());
378
363
379
364
#ifdef VERBOSE
380
365
std::cout << " === gettxoutsetinfo ===" << std::endl;
@@ -393,7 +378,7 @@ BOOST_AUTO_TEST_CASE(ListUnspent) {
393
378
MyFixture fx;
394
379
395
380
std::vector<unspenttxout_t > response;
396
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listunspent ());
381
+ NO_THROW (response = fx.btc .listunspent ());
397
382
398
383
#ifdef VERBOSE
399
384
std::cout << " === listunspent ===" << std::endl;
@@ -415,7 +400,7 @@ BOOST_AUTO_TEST_CASE(ListLockUnspent) {
415
400
MyFixture fx;
416
401
417
402
std::vector<txout_t > response;
418
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listlockunspent ());
403
+ NO_THROW (response = fx.btc .listlockunspent ());
419
404
420
405
#ifdef VERBOSE
421
406
std::cout << " === listlockunspent ===" << std::endl;
@@ -436,7 +421,7 @@ BOOST_AUTO_TEST_CASE(LockUnspent) {
436
421
param.push_back (tmp);
437
422
bool response;
438
423
439
- BOOST_REQUIRE_NO_THROW (response = fx.btc .lockunspent (false , param));
424
+ NO_THROW (response = fx.btc .lockunspent (false , param));
440
425
BOOST_REQUIRE (response == true );
441
426
}
442
427
@@ -445,7 +430,7 @@ BOOST_AUTO_TEST_CASE(ListAddressGroupings) {
445
430
MyFixture fx;
446
431
std::vector< std::vector<addressgrouping_t > > response;
447
432
448
- BOOST_REQUIRE_NO_THROW (response = fx.btc .listaddressgroupings ());
433
+ NO_THROW (response = fx.btc .listaddressgroupings ());
449
434
450
435
#ifdef VERBOSE
451
436
std::cout << " === listaddressgroupings ===" << std::endl;
0 commit comments