[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 15/24: fix trait usage
From: |
gnunet |
Subject: |
[taler-merchant] 15/24: fix trait usage |
Date: |
Wed, 17 Nov 2021 12:44:38 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 874a89a648c9f06e54a9e5a3bdc987a87ef8247b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Nov 4 21:02:35 2021 +0100
fix trait usage
---
src/testing/testing_api_cmd_merchant_get_tip.c | 18 ++++-----
src/testing/testing_api_cmd_tip_pickup.c | 53 ++++++++++++--------------
2 files changed, 33 insertions(+), 38 deletions(-)
diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c
b/src/testing/testing_api_cmd_merchant_get_tip.c
index 791fc731..81be677d 100644
--- a/src/testing/testing_api_cmd_merchant_get_tip.c
+++ b/src/testing/testing_api_cmd_merchant_get_tip.c
@@ -210,15 +210,13 @@ merchant_get_tip_cb (void *cls,
const struct TALER_Amount *total;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_amounts (pickup_cmd,
- pickups[i].num_planchets,
- &total))
+ TALER_TESTING_get_trait_amount (pickup_cmd,
+ &total))
TALER_TESTING_FAIL (gts->is);
if ( (GNUNET_OK !=
TALER_amount_cmp_currency (total,
- &pickups[i].
- requested_amount)) ||
+ &pickups[i].requested_amount)) ||
(0 != TALER_amount_cmp (total,
&pickups[i].requested_amount)))
{
@@ -232,10 +230,12 @@ merchant_get_tip_cb (void *cls,
total));
}
}
- if ((GNUNET_OK != TALER_amount_cmp_currency (&expected_total_picked_up,
- total_picked_up)) ||
- (0 != TALER_amount_cmp (&expected_total_picked_up,
- total_picked_up)))
+ if ( (GNUNET_OK !=
+ TALER_amount_cmp_currency (&expected_total_picked_up,
+ total_picked_up)) ||
+ (0 !=
+ TALER_amount_cmp (&expected_total_picked_up,
+ total_picked_up)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Tip picked up amount does not match\n");
diff --git a/src/testing/testing_api_cmd_tip_pickup.c
b/src/testing/testing_api_cmd_tip_pickup.c
index 1c72f02b..cd73c53d 100644
--- a/src/testing/testing_api_cmd_tip_pickup.c
+++ b/src/testing/testing_api_cmd_tip_pickup.c
@@ -323,44 +323,39 @@ tip_pickup_cleanup (void *cls,
}
-static int
+static enum GNUNET_GenericReturnValue
tip_pickup_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
struct TipPickupState *tps = cls;
- #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++)
+ if (index >= tps->num_coins)
+ return GNUNET_SYSERR;
{
- traits[i] = TALER_TESTING_make_trait_planchet_secrets (i,
- &tps->psa[i]);
- traits[i + tps->num_coins] =
- TALER_TESTING_make_trait_coin_priv (i,
- &tps->psa[i].coin_priv);
- traits[i + (tps->num_coins * 2)] =
- TALER_TESTING_make_trait_denom_pub (i,
- tps->dks[i]);
- traits[i + (tps->num_coins * 3)] =
- TALER_TESTING_make_trait_denom_sig (i,
- &tps->sigs[i]);
- traits[i + (tps->num_coins * 4)] =
- TALER_TESTING_make_trait_amounts (i,
- &tps->amounts_obj[i]);
+ struct TALER_TESTING_Trait traits[] = {
+ TALER_TESTING_make_trait_planchet_secrets (index,
+ &tps->psa[index]),
+ TALER_TESTING_make_trait_coin_priv (index,
+ &tps->psa[index].coin_priv),
+ TALER_TESTING_make_trait_denom_pub (index,
+ tps->dks[index]),
+ TALER_TESTING_make_trait_denom_sig (index,
+ &tps->sigs[index]),
+ TALER_TESTING_make_trait_amounts (index,
+ &tps->amounts_obj[index]),
+ TALER_TESTING_make_trait_amount (&tps->total_amount),
+ TALER_TESTING_make_trait_num_planchets (&tps->num_coins),
+ TALER_TESTING_make_trait_exchange_url (&tps->exchange_url),
+ TALER_TESTING_trait_end ()
+ };
+
+ return TALER_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
}
- traits[NUM_TRAITS - 4]
- = TALER_TESTING_make_trait_amount (&tps->total_amount);
- traits[NUM_TRAITS - 3]
- = TALER_TESTING_make_trait_num_planchets (&tps->num_coins);
- traits[NUM_TRAITS - 2]
- = TALER_TESTING_make_trait_exchange_url (&tps->exchange_url);
- traits[NUM_TRAITS - 1] = TALER_TESTING_trait_end ();
- return TALER_TESTING_get_trait (traits,
- ret,
- trait,
- index);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] branch master updated (99e7729e -> 39e6ebbc), gnunet, 2021/11/17
- [taler-merchant] 04/24: -work on FTBFS, gnunet, 2021/11/17
- [taler-merchant] 03/24: -work on FTBFS of src/testing, gnunet, 2021/11/17
- [taler-merchant] 01/24: -work on fixing FTBFS, gnunet, 2021/11/17
- [taler-merchant] 02/24: fix lib/ FTBFS, gnunet, 2021/11/17
- [taler-merchant] 07/24: -fix FTBFS, gnunet, 2021/11/17
- [taler-merchant] 11/24: add ACCEPTED case, gnunet, 2021/11/17
- [taler-merchant] 05/24: fix FTBFS, gnunet, 2021/11/17
- [taler-merchant] 18/24: update to match latest exchange structures, gnunet, 2021/11/17
- [taler-merchant] 06/24: fix fTBFS, gnunet, 2021/11/17
- [taler-merchant] 15/24: fix trait usage,
gnunet <=
- [taler-merchant] 13/24: bugfix pickup DLL mangement logic, gnunet, 2021/11/17
- [taler-merchant] 12/24: fix trait used, gnunet, 2021/11/17
- [taler-merchant] 20/24: add new KYC command, gnunet, 2021/11/17
- [taler-merchant] 14/24: -fix test, gnunet, 2021/11/17
- [taler-merchant] 10/24: fix bizarre logic error, gnunet, 2021/11/17
- [taler-merchant] 08/24: get backenddb test to pass, gnunet, 2021/11/17
- [taler-merchant] 17/24: fix signature in test, gnunet, 2021/11/17
- [taler-merchant] 09/24: fix post order trait usage, gnunet, 2021/11/17
- [taler-merchant] 16/24: introduce TALER_wallet_deposit_verify, gnunet, 2021/11/17
- [taler-merchant] 19/24: finish merchant client api /kyc implementation, gnunet, 2021/11/17