diff options
author | ng0 <ng0@n0.is> | 2019-04-16 18:52:55 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-04-16 18:55:10 +0000 |
commit | 50d4ec0bede4fcd4ca6c144e49bc896b3956b3fd (patch) | |
tree | 5f3bdc553a3e0eea2708679a8cab5c6e65378a93 /src/backenddb | |
parent | 6883d8a3b5727f00f1dedc50d8a770ae943d13ce (diff) | |
download | merchant-50d4ec0bede4fcd4ca6c144e49bc896b3956b3fd.tar.gz merchant-50d4ec0bede4fcd4ca6c144e49bc896b3956b3fd.tar.bz2 merchant-50d4ec0bede4fcd4ca6c144e49bc896b3956b3fd.zip |
backenddb: Refactor test_merchantdb for GNUNET_memcmp.
Since I can't build merchant right now due to
https://bugs.gnunet.org/view.php?id=5688
this is best effort double checked to be correct.
Diffstat (limited to 'src/backenddb')
-rw-r--r-- | src/backenddb/test_merchantdb.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index 2893342d..0ecc5b4e 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -255,19 +255,17 @@ static void deposit_cb (void *cls, const struct GNUNET_HashCode *ah_contract_terms, const struct TALER_CoinSpendPublicKeyP *acoin_pub, - const char *aexchange_url, + const char *aexchange_url, const struct TALER_Amount *aamount_with_fee, const struct TALER_Amount *adeposit_fee, const struct TALER_Amount *arefund_fee, const struct TALER_Amount *awire_fee, const json_t *aexchange_proof) { - CHECK ((0 == memcmp (ah_contract_terms, - &h_contract_terms, - sizeof (struct GNUNET_HashCode)))); - CHECK (0 == memcmp (acoin_pub, - &coin_pub, - sizeof (struct TALER_CoinSpendPublicKeyP))); + CHECK ((0 == GNUNET_memcmp (ah_contract_terms, + &h_contract_terms))); + CHECK (0 == GNUNET_memcmp (acoin_pub, + &coin_pub)); CHECK (0 == strcmp (aexchange_url, EXCHANGE_URL)); CHECK (0 == TALER_amount_cmp (aamount_with_fee, @@ -306,16 +304,13 @@ transfer_cb (void *cls, struct GNUNET_TIME_Absolute execution_time, const json_t *exchange_proof) { - CHECK (0 == memcmp (ah_contract_terms, - &h_contract_terms, - sizeof (struct GNUNET_HashCode))); - - CHECK (0 == memcmp (acoin_pub, - &coin_pub, - sizeof (struct TALER_CoinSpendPublicKeyP))); - CHECK (0 == memcmp (awtid, - &wtid, - sizeof (struct TALER_WireTransferIdentifierRawP))); + CHECK (0 == GNUNET_memcmp (ah_contract_terms, + &h_contract_terms)); + + CHECK (0 == GNUNET_memcmp (acoin_pub, + &coin_pub)); + CHECK (0 == GNUNET_memcmp (awtid, + &wtid)); CHECK (1 == json_equal ((json_t *) exchange_proof, transfer_proof)); } @@ -426,9 +421,8 @@ test_wire_fee () } if ( (start_date.abs_value_us != date2.abs_value_us) || (end_date.abs_value_us != date3.abs_value_us) || - (0 != memcmp (&exchange_sig, - &exchange_sig2, - sizeof (exchange_sig))) || + (0 != GNUNET_memcmp (&exchange_sig, + &exchange_sig2)) || (0 != TALER_amount_cmp (&wire_fee2, &wire_fee3)) || (0 != TALER_amount_cmp (&closing_fee2, @@ -455,9 +449,8 @@ test_wire_fee () } if ( (start_date.abs_value_us != date1.abs_value_us) || (end_date.abs_value_us != date2.abs_value_us) || - (0 != memcmp (&exchange_sig, - &exchange_sig2, - sizeof (exchange_sig))) || + (0 != GNUNET_memcmp (&exchange_sig, + &exchange_sig2)) || (0 != TALER_amount_cmp (&wire_fee1, &wire_fee3)) || (0 != TALER_amount_cmp (&closing_fee1, @@ -662,9 +655,8 @@ test_tipping () GNUNET_break (0); return GNUNET_SYSERR; } - if (0 != memcmp (&pres, - &tip_reserve_priv, - sizeof (pres))) + if (0 != GNUNET_memcmp (&pres, + &tip_reserve_priv)) { GNUNET_break (0); return GNUNET_SYSERR; @@ -680,9 +672,8 @@ test_tipping () GNUNET_break (0); return GNUNET_SYSERR; } - if (0 != memcmp (&pres, - &tip_reserve_priv, - sizeof (pres))) + if (0 != GNUNET_memcmp (&pres, + &tip_reserve_priv)) { GNUNET_break (0); return GNUNET_SYSERR; |