diff options
Diffstat (limited to 'src/mint/test_mint_db.c')
-rw-r--r-- | src/mint/test_mint_db.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/mint/test_mint_db.c b/src/mint/test_mint_db.c index 192bc1e09..195fa275b 100644 --- a/src/mint/test_mint_db.c +++ b/src/mint/test_mint_db.c @@ -25,6 +25,13 @@ static int result; +#define FAILIF(cond) \ + do { \ + if (!(cond)){ break;} \ + GNUNET_break (0); \ + goto drop; \ + } while (0) + /** * Main function that will be run by the scheduler. @@ -68,13 +75,19 @@ run (void *cls, char *const *args, const char *cfgfile, strcpy (amount.currency, "EUR"); expiry = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), GNUNET_TIME_UNIT_HOURS); - if (GNUNET_OK != TALER_MINT_DB_reserves_in_insert (db, - &reserve, - amount, - expiry)) + result = 4; + FAILIF (GNUNET_OK != TALER_MINT_DB_reserves_in_insert (db, + &reserve, + amount, + expiry)); { - result = 4; - goto drop; + struct Reserve g_reserve; + g_reserve.pub = &pub; + FAILIF (GNUNET_OK != TALER_MINT_DB_reserve_get (db, &g_reserve)); + FAILIF (amount.value != g_reserve.balance.value); + FAILIF (amount.fraction != g_reserve.balance.fraction); + FAILIF (0 != strcmp (amount.currency, g_reserve.balance.currency)); + FAILIF (expiry.abs_value_us != g_reserve.expiry.abs_value_us); } result = 0; drop: |