diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mint/mint_db.c | 2 | ||||
-rw-r--r-- | src/mint/test_mint_db.c | 25 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/mint/mint_db.c b/src/mint/mint_db.c index 2797f216..b102accf 100644 --- a/src/mint/mint_db.c +++ b/src/mint/mint_db.c @@ -743,7 +743,7 @@ TALER_MINT_DB_reserve_get (PGconn *db, TALER_DB_extract_amount (result, 0, "current_balance_value", "current_balance_fraction", - "current_balance_currency", + "balance_currency", &reserve->balance)); reserve->expiry.abs_value_us = GNUNET_ntohll (expiration_date_nbo); PQclear (result); diff --git a/src/mint/test_mint_db.c b/src/mint/test_mint_db.c index 192bc1e0..195fa275 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: |