diff options
author | tg(x) <*@tg-x.net> | 2016-11-06 14:24:17 +0100 |
---|---|---|
committer | tg(x) <*@tg-x.net> | 2016-11-06 14:24:17 +0100 |
commit | 247b8e33b3ea20407910929c78232ff0d44e8d9a (patch) | |
tree | c5e933cdb0be4c9a18d8f7eb900a8a350d57254e /src/auditordb/test_auditordb.c | |
parent | 02d28bc81cf2b163950d8c7e11b8dd9fd26ebaff (diff) | |
download | exchange-247b8e33b3ea20407910929c78232ff0d44e8d9a.tar.gz exchange-247b8e33b3ea20407910929c78232ff0d44e8d9a.tar.bz2 exchange-247b8e33b3ea20407910929c78232ff0d44e8d9a.zip |
auditordb postgres plugin: auditor_progress implementation + tests
Diffstat (limited to 'src/auditordb/test_auditordb.c')
-rw-r--r-- | src/auditordb/test_auditordb.c | 96 |
1 files changed, 76 insertions, 20 deletions
diff --git a/src/auditordb/test_auditordb.c b/src/auditordb/test_auditordb.c index 673ab47b..93c27938 100644 --- a/src/auditordb/test_auditordb.c +++ b/src/auditordb/test_auditordb.c @@ -16,7 +16,7 @@ /** * @file auditordb/test_auditordb.c * @brief test cases for DB interaction functions - * @author Gabor Toth + * @author Gabor X Toth */ #include "platform.h" #include "taler_auditordb_lib.h" @@ -32,10 +32,10 @@ static int result = -1; * Report line of error if @a cond is true, and jump to label "drop". */ #define FAILIF(cond) \ - do { \ - if (!(cond)){ break;} \ - GNUNET_break (0); \ - /*goto drop;*/ \ + do { \ + if (!(cond)){ break;} \ + GNUNET_break (0); \ + goto drop; \ } while (0) @@ -199,6 +199,77 @@ run (void *cls) &issue)); GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Test: insert_auditor_progress\n"); + + uint64_t + last_reserve_in_serial_id = 1234, + last_reserve_out_serial_id = 5678, + last_deposit_serial_id = 123, + last_melt_serial_id = 456, + last_refund_serial_id = 789, + last_prewire_serial_id = 555, + + last_reserve_in_serial_id2 = 0, + last_reserve_out_serial_id2 = 0, + last_deposit_serial_id2 = 0, + last_melt_serial_id2 = 0, + last_refund_serial_id2 = 0, + last_prewire_serial_id2 = 0; + + FAILIF (GNUNET_OK != + plugin->insert_auditor_progress (plugin->cls, + session, + &master_pub, + last_reserve_in_serial_id, + last_reserve_out_serial_id, + last_deposit_serial_id, + last_melt_serial_id, + last_refund_serial_id, + last_prewire_serial_id)); + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Test: update_auditor_progress\n"); + + last_reserve_in_serial_id++; + last_reserve_out_serial_id++; + last_deposit_serial_id2++; + last_melt_serial_id2++; + last_refund_serial_id2++; + last_prewire_serial_id2++; + + FAILIF (GNUNET_OK != + plugin->update_auditor_progress (plugin->cls, + session, + &master_pub, + last_reserve_in_serial_id, + last_reserve_out_serial_id, + last_deposit_serial_id, + last_melt_serial_id, + last_refund_serial_id, + last_prewire_serial_id)); + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Test: get_auditor_progress\n"); + + FAILIF (GNUNET_OK != + plugin->get_auditor_progress (plugin->cls, + session, + &master_pub, + &last_reserve_in_serial_id2, + &last_reserve_out_serial_id2, + &last_deposit_serial_id2, + &last_melt_serial_id2, + &last_refund_serial_id2, + &last_prewire_serial_id2)); + + FAILIF (last_reserve_in_serial_id2 != last_reserve_in_serial_id + || last_reserve_out_serial_id2 != last_reserve_out_serial_id + || last_deposit_serial_id2 != last_deposit_serial_id + || last_melt_serial_id2 != last_melt_serial_id + || last_refund_serial_id2 != last_refund_serial_id + || last_prewire_serial_id2 != last_prewire_serial_id); + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Test: insert_reserve_info\n"); struct TALER_Amount reserve_balance, withdraw_fee_balance; @@ -211,12 +282,6 @@ run (void *cls) TALER_string_to_amount (CURRENCY ":23.456789", &withdraw_fee_balance)); - uint64_t - last_reserve_in_serial_id = 1234, - last_reserve_out_serial_id = 5678, - last_reserve_in_serial_id2 = 0, - last_reserve_out_serial_id2 =0; - FAILIF (GNUNET_OK != plugin->insert_reserve_info (plugin->cls, session, @@ -320,15 +385,6 @@ run (void *cls) TALER_string_to_amount (CURRENCY ":45.678901", &refund_fee_balance)); - uint64_t - last_deposit_serial_id = 123, - last_melt_serial_id = 456, - last_refund_serial_id = 789, - - last_deposit_serial_id2 = 0, - last_melt_serial_id2 = 0, - last_refund_serial_id2 =0; - FAILIF (GNUNET_OK != plugin->insert_denomination_balance (plugin->cls, session, |