gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: backenddb: Refactor


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: backenddb: Refactor test_merchantdb for GNUNET_memcmp.
Date: Tue, 16 Apr 2019 20:55:20 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 50d4ec0  backenddb: Refactor test_merchantdb for GNUNET_memcmp.
50d4ec0 is described below

commit 50d4ec0bede4fcd4ca6c144e49bc896b3956b3fd
Author: ng0 <address@hidden>
AuthorDate: Tue Apr 16 18:52:55 2019 +0000

    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.
---
 src/backenddb/test_merchantdb.c | 49 +++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 2893342..0ecc5b4 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;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]