summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-08 16:07:17 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-08 16:07:17 +0200
commit068dbf020b1f762d4364ca378c1396d16fa6eb1a (patch)
treea49373ea045d86dfadfbc7240617fe6213143a21 /src/exchangedb
parentffb38f292e4757e152180d4d7a9c870c7e0482e6 (diff)
downloadexchange-068dbf020b1f762d4364ca378c1396d16fa6eb1a.tar.gz
exchange-068dbf020b1f762d4364ca378c1396d16fa6eb1a.tar.bz2
exchange-068dbf020b1f762d4364ca378c1396d16fa6eb1a.zip
reorg testcase a bit
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c6
-rw-r--r--src/exchangedb/test_exchangedb.c58
2 files changed, 52 insertions, 12 deletions
diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c
index 631142e86..8bb214efb 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -154,8 +154,10 @@ common_free_melt_commitment (void *cls,
{
for (i=0;i<mc->num_newcoins;i++)
{
- GNUNET_free (mc->commit_coins[k][i].refresh_link);
- GNUNET_free (mc->commit_coins[k][i].coin_ev);
+ /* NOTE: 'non_null' because this API is used also
+ internally to clean up the struct on failures! */
+ GNUNET_free_non_null (mc->commit_coins[k][i].refresh_link);
+ GNUNET_free_non_null (mc->commit_coins[k][i].coin_ev);
}
GNUNET_free (mc->commit_coins[k]);
}
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 974290ee3..2feeb5247 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -324,10 +324,12 @@ free_refresh_commit_coins_array (struct TALER_EXCHANGEDB_RefreshCommitCoin *comm
#define MELT_NEW_COINS 5
/**
+ * Test APIs related to the "insert_refresh_commit_coins" function.
*
* @param session database sesison to use
* @param refresh_session details about the refresh session to use
* @param session_hash refresh melt session hash to use
+ * @return #GNUNET_OK on success
*/
static int
test_refresh_commit_coins (struct TALER_EXCHANGEDB_Session *session,
@@ -421,6 +423,32 @@ test_refresh_commit_coins (struct TALER_EXCHANGEDB_Session *session,
/**
+ * Test APIs related to the "insert_refresh_commit_coins" function.
+ *
+ * @param session database sesison to use
+ * @param refresh_session details about the refresh session to use
+ * @param session_hash refresh melt session hash to use
+ * @return #GNUNET_OK on success
+ */
+static int
+test_refresh_commit_links (struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_EXCHANGEDB_RefreshSession *refresh_session,
+ const struct GNUNET_HashCode *session_hash)
+{
+ /*
+ FIXME #4401: test: insert_refresh_commit_links
+ FIXME #4401: test: get_refresh_commit_links
+
+ FIXME #4401: test: get_link_data_list
+ FIXME #4401: test: free_link_data_list
+ FIXME #4401: test: get_transfer
+
+ */
+ return GNUNET_OK;
+}
+
+
+/**
* Function to test melting of coins as part of a refresh session
*
* @param session the database session
@@ -440,6 +468,7 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
struct TALER_EXCHANGEDB_RefreshMelt *melts;
struct TALER_DenominationPublicKey *new_denom_pubs;
struct TALER_DenominationPublicKey *ret_denom_pubs;
+ struct TALER_EXCHANGEDB_MeltCommitment *mc;
unsigned int cnt;
int ret;
@@ -565,6 +594,25 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
test_refresh_commit_coins (session,
&refresh_session,
&session_hash));
+ FAILIF (GNUNET_OK !=
+ test_refresh_commit_links (session,
+ &refresh_session,
+ &session_hash));
+
+ /* checking 'get_melt_commitment' API */
+ mc = plugin->get_melt_commitment (plugin->cls,
+ session,
+ &session_hash);
+ FAILIF (NULL != mc); /* NOTE: this will change once
+ 'test_refresh_commit_links' is implemented properly */
+#if 0
+ /* FIXME #4401: test: get_melt_commitment:
+ check detailed information contained in 'mc' */
+ plugin->free_melt_commitment (plugin->cls,
+ mc);
+#endif
+
+ /* FIXME #4401: test: insert_refresh_out */
ret = GNUNET_OK;
@@ -1179,16 +1227,6 @@ run (void *cls)
FAILIF (GNUNET_OK != test_wire_prepare (session));
- /* FIXME #4401: test: insert_refresh_commit_links
- FIXME #4401: test: get_refresh_commit_links
- FIXME #4401: test: get_melt_commitment
- FIXME #4401: test: free_melt_commitment
- FIXME #4401: test: insert_refresh_out
- FIXME #4401: test: get_link_data_list
- FIXME #4401: test: free_link_data_list
- FIXME #4401: test: get_transfer
- */
-
/* setup values for wire transfer aggregation data */
memset (&wtid, 42, sizeof (wtid));
memset (&merchant_pub_wt, 43, sizeof (merchant_pub_wt));