summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_tip_pickup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_tip_pickup.c')
-rw-r--r--src/testing/testing_api_cmd_tip_pickup.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/testing/testing_api_cmd_tip_pickup.c b/src/testing/testing_api_cmd_tip_pickup.c
index d05b20d4..833ab6bc 100644
--- a/src/testing/testing_api_cmd_tip_pickup.c
+++ b/src/testing/testing_api_cmd_tip_pickup.c
@@ -85,9 +85,14 @@ struct TipPickupState
struct TALER_Amount *amounts_obj;
/**
+ * The sum of the the amounts above.
+ */
+ struct TALER_Amount total_amount;
+
+ /**
* How many coins are involved in the tipping operation.
*/
- unsigned int num_coins;
+ uint64_t num_coins;
/**
* The array of denomination keys, in the same order of @a
@@ -237,6 +242,15 @@ tip_pickup_run (void *cls,
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (tps->amounts[i],
&tps->amounts_obj[i]));
+ if (0 == i)
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_get_zero (tps->amounts_obj[i].currency,
+ &tps->total_amount));
+
+ GNUNET_assert (0 <
+ TALER_amount_add (&tps->total_amount,
+ &tps->total_amount,
+ &tps->amounts_obj[i]));
tps->dks[i] = TALER_TESTING_find_pk (is->keys,
&tps->amounts_obj[i]);
if (NULL == tps->dks[i])
@@ -329,7 +343,7 @@ tip_pickup_traits (void *cls,
unsigned int index)
{
struct TipPickupState *tps = cls;
- #define NUM_TRAITS (tps->num_coins * 5) + 2
+ #define NUM_TRAITS (tps->num_coins * 5) + 4
struct TALER_TESTING_Trait traits[NUM_TRAITS];
for (unsigned int i = 0; i<tps->num_coins; i++)
@@ -345,6 +359,12 @@ tip_pickup_traits (void *cls,
traits[i + (tps->num_coins * 4)] =
TALER_TESTING_make_trait_amount_obj (i, &tps->amounts_obj[i]);
}
+ traits[NUM_TRAITS - 4]
+ = TALER_TESTING_make_trait_amount_obj (tps->num_coins,
+ &tps->total_amount);
+ traits[NUM_TRAITS - 3]
+ = TALER_TESTING_make_trait_uint64 (0,
+ &tps->num_coins);
traits[NUM_TRAITS - 2]
= TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
tps->exchange_url);