gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (63109b6 -> d20c94d)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (63109b6 -> d20c94d)
Date: Fri, 16 Feb 2018 17:01:58 +0100

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

marcello pushed a change to branch master
in repository exchange.

    from 63109b6  paste leftover
     new 513a22c  offering amount _objects_ as traits (a string version of it 
was already implemented).  "Withdraw" command uses it.
     new 7ffc6d0  hash code trait
     new d20c94d  indent

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/exchange-lib/Makefile.am                       |  4 +-
 src/exchange-lib/testing_api_cmd_withdraw.c        |  5 ++
 src/exchange-lib/testing_api_trait_amount.c        | 71 ++++++++++++++++++++++
 src/exchange-lib/testing_api_trait_blinding_key.c  | 30 +++++----
 src/exchange-lib/testing_api_trait_denom_sig.c     | 36 ++++++-----
 ...g_api_trait_wtid.c => testing_api_trait_hash.c} | 34 +++++------
 src/exchange-lib/testing_api_trait_reserve_priv.c  | 36 ++++++-----
 src/include/taler_testing_lib.h                    | 49 +++++++++++++++
 8 files changed, 204 insertions(+), 61 deletions(-)
 create mode 100644 src/exchange-lib/testing_api_trait_amount.c
 copy src/exchange-lib/{testing_api_trait_wtid.c => testing_api_trait_hash.c} 
(65%)

diff --git a/src/exchange-lib/Makefile.am b/src/exchange-lib/Makefile.am
index cf80a1d..00815db 100644
--- a/src/exchange-lib/Makefile.am
+++ b/src/exchange-lib/Makefile.am
@@ -67,7 +67,9 @@ libtalertesting_la_SOURCES = \
   testing_api_trait_fresh_coin.c \
   testing_api_trait_string.c \
   testing_api_trait_key_peer.c \
-  testing_api_trait_wtid.c
+  testing_api_trait_wtid.c \
+  testing_api_trait_amount.c \
+  testing_api_trait_hash.c
 
 libtalertesting_la_LIBADD = \
   $(top_builddir)/src/json/libtalerjson.la \
diff --git a/src/exchange-lib/testing_api_cmd_withdraw.c 
b/src/exchange-lib/testing_api_cmd_withdraw.c
index eb3bc8a..07dad69 100644
--- a/src/exchange-lib/testing_api_cmd_withdraw.c
+++ b/src/exchange-lib/testing_api_cmd_withdraw.c
@@ -286,6 +286,11 @@ withdraw_traits (void *cls,
                                         &ws->sig),
     TALER_TESTING_make_trait_reserve_priv (0,
                                            reserve_priv),
+    TALER_TESTING_make_trait_amount_obj (0,
+                                         &ws->amount),
+    TALER_TESTING_make_trait_url (
+      0, MAH_path_to_url (ws->exchange, "/")),
+
     TALER_TESTING_trait_end ()
   };
 
diff --git a/src/exchange-lib/testing_api_trait_amount.c 
b/src/exchange-lib/testing_api_trait_amount.c
new file mode 100644
index 0000000..a9c5b3b
--- /dev/null
+++ b/src/exchange-lib/testing_api_trait_amount.c
@@ -0,0 +1,71 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2018 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3,
+  or (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+
+/**
+ * @file exchange-lib/testing_api_trait_amount.c
+ * @brief offer amounts as traits
+ * @author Marcello Stanisci
+ */
+
+#include "platform.h"
+#include "taler_json_lib.h"
+#include <gnunet/gnunet_curl_lib.h>
+#include "exchange_api_handle.h"
+#include "taler_signatures.h"
+#include "taler_testing_lib.h"
+
+#define TALER_TESTING_TRAIT_AMOUNT "amount"
+
+/**
+ * Obtain an amount from a @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which amount to pick if @a cmd has multiple
+ *        on offer
+ * @param amount[out] set to the amount
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_amount_obj (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_Amount **amount)
+{
+  return cmd->traits (cmd->cls,
+                      (void **) amount,
+                      TALER_TESTING_TRAIT_AMOUNT,
+                      index);
+}
+
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_amount_obj (
+  unsigned int index,
+  const struct TALER_Amount *amount)
+{
+  struct TALER_TESTING_Trait ret = {
+    .index = index,
+    .trait_name = TALER_TESTING_TRAIT_AMOUNT,
+    .ptr = (const void *) amount
+  };
+
+  return ret;
+}
+
+
+/* end of testing_api_trait_amount.c */
diff --git a/src/exchange-lib/testing_api_trait_blinding_key.c 
b/src/exchange-lib/testing_api_trait_blinding_key.c
index c9415ca..23eb7ac 100644
--- a/src/exchange-lib/testing_api_trait_blinding_key.c
+++ b/src/exchange-lib/testing_api_trait_blinding_key.c
@@ -2,16 +2,18 @@
   This file is part of TALER
   Copyright (C) 2018 Taler Systems SA
 
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU General Public License as published by the Free Software
-  Foundation; either version 3, or (at your option) any later version.
+  TALER is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published
+  by the Free Software Foundation; either version 3, or (at your
+  option) any later version.
 
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-  You should have received a copy of the GNU General Public License along with
-  TALER; see the file COPYING.  If not, see
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
   <http://www.gnu.org/licenses/>
 */
 /**
@@ -39,9 +41,10 @@
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_blinding_key (const struct TALER_TESTING_Command *cmd,
-                                      unsigned int index,
-                                      struct TALER_DenominationBlindingKeyP 
**blinding_key)
+TALER_TESTING_get_trait_blinding_key (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_DenominationBlindingKeyP **blinding_key)
 {
   return cmd->traits (cmd->cls,
                       (void **) blinding_key,
@@ -51,8 +54,9 @@ TALER_TESTING_get_trait_blinding_key (const struct 
TALER_TESTING_Command *cmd,
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_blinding_key (unsigned int index,
-                                       const struct 
TALER_DenominationBlindingKeyP *blinding_key)
+TALER_TESTING_make_trait_blinding_key (
+  unsigned int index,
+  const struct TALER_DenominationBlindingKeyP *blinding_key)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/exchange-lib/testing_api_trait_denom_sig.c 
b/src/exchange-lib/testing_api_trait_denom_sig.c
index 9578277..e50a3ba 100644
--- a/src/exchange-lib/testing_api_trait_denom_sig.c
+++ b/src/exchange-lib/testing_api_trait_denom_sig.c
@@ -2,21 +2,24 @@
   This file is part of TALER
   Copyright (C) 2018 Taler Systems SA
 
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU General Public License as published by the Free Software
-  Foundation; either version 3, or (at your option) any later version.
+  TALER is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3,
+  or (at your option) any later version.
 
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-  You should have received a copy of the GNU General Public License along with
-  TALER; see the file COPYING.  If not, see
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
   <http://www.gnu.org/licenses/>
 */
+
 /**
  * @file exchange-lib/testing_api_trait_denom_sig.c
- * @brief main interpreter loop for testcases
+ * @brief offer denomination signatures as traits
  * @author Christian Grothoff
  * @author Marcello Stanisci
  */
@@ -34,14 +37,16 @@
  * Obtain a denomination signature from a @a cmd.
  *
  * @param cmd command to extract trait from
- * @param selector which signature to pick if @a cmd has multiple on offer
+ * @param selector which signature to pick if @a cmd has multiple
+ *        on offer
  * @param denom_sig[out] set to the signature
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_denom_sig (const struct TALER_TESTING_Command *cmd,
-                                   unsigned int index,
-                                   struct TALER_DenominationSignature 
**denom_sig)
+TALER_TESTING_get_trait_denom_sig (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_DenominationSignature **denom_sig)
 {
   return cmd->traits (cmd->cls,
                       (void **) denom_sig,
@@ -51,8 +56,9 @@ TALER_TESTING_get_trait_denom_sig (const struct 
TALER_TESTING_Command *cmd,
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_denom_sig (unsigned int index,
-                                    const struct TALER_DenominationSignature 
*denom_sig)
+TALER_TESTING_make_trait_denom_sig (
+  unsigned int index,
+  const struct TALER_DenominationSignature *denom_sig)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/exchange-lib/testing_api_trait_wtid.c 
b/src/exchange-lib/testing_api_trait_hash.c
similarity index 65%
copy from src/exchange-lib/testing_api_trait_wtid.c
copy to src/exchange-lib/testing_api_trait_hash.c
index 140a2ac..5a8ed7d 100644
--- a/src/exchange-lib/testing_api_trait_wtid.c
+++ b/src/exchange-lib/testing_api_trait_hash.c
@@ -18,8 +18,8 @@
 */
 
 /**
- * @file exchange-lib/testing_api_trait_number.c
- * @brief traits to offer numbers
+ * @file exchange-lib/testing_api_trait_hash.c
+ * @brief traits to offer hash codes.
  * @author Marcello Stanisci
  */
 #include "platform.h"
@@ -29,46 +29,46 @@
 #include "taler_signatures.h"
 #include "taler_testing_lib.h"
 
-#define TALER_TESTING_TRAIT_WTID "wtid"
+#define TALER_TESTING_TRAIT_HASH "hash"
 
 /**
- * Obtain a WTID value from @a cmd.
+ * Obtain a hash code from @a cmd.
  *
  * @param cmd command to extract trait from
- * @param index which WTID to pick if @a cmd has multiple on
+ * @param index which hash code to pick if @a cmd has multiple on
  *        offer
- * @param wtid[out] set to the wanted WTID.
+ * @param wtid[out] set to the wanted hash code.
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_wtid
+TALER_TESTING_get_trait_hash
   (const struct TALER_TESTING_Command *cmd,
    unsigned int index,
-   struct TALER_WireTransferIdentifierRawP **wtid)
+   struct GNUNET_HashCode **hash)
 {
   return cmd->traits (cmd->cls,
-                      (void **) wtid,
-                      TALER_TESTING_TRAIT_WTID,
+                      (void **) hash,
+                      TALER_TESTING_TRAIT_HASH,
                       index);
 }
 
 /**
- * @param index associate the object with this index
- * @param wtid which object should be returned
+ * @param index associate the hash code with this index
+ * @param hash which hash code should be returned
  *
  * @return the trait, to be put in the traits array of the command
  */
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_wtid
+TALER_TESTING_make_trait_hash
   (unsigned int index,
-   struct TALER_WireTransferIdentifierRawP *wtid)
+   struct GNUNET_HashCode *hash)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
-    .trait_name = TALER_TESTING_TRAIT_WTID,
-    .ptr = (const void *) wtid
+    .trait_name = TALER_TESTING_TRAIT_HASH,
+    .ptr = (const void *) hash
   };
   return ret;
 }
 
-/* end of testing_api_trait_number.c */
+/* end of testing_api_trait_hash.c */
diff --git a/src/exchange-lib/testing_api_trait_reserve_priv.c 
b/src/exchange-lib/testing_api_trait_reserve_priv.c
index fb80a06..971741f 100644
--- a/src/exchange-lib/testing_api_trait_reserve_priv.c
+++ b/src/exchange-lib/testing_api_trait_reserve_priv.c
@@ -2,16 +2,18 @@
   This file is part of TALER
   Copyright (C) 2018 Taler Systems SA
 
-  TALER is free software; you can redistribute it and/or modify it under the
-  terms of the GNU General Public License as published by the Free Software
-  Foundation; either version 3, or (at your option) any later version.
+  TALER is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 3, or
+  (at your option) any later version.
 
-  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+  TALER is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-  You should have received a copy of the GNU General Public License along with
-  TALER; see the file COPYING.  If not, see
+  You should have received a copy of the GNU General Public
+  License along with TALER; see the file COPYING.  If not, see
   <http://www.gnu.org/licenses/>
 */
 /**
@@ -27,20 +29,23 @@
 #include "taler_signatures.h"
 #include "taler_testing_lib.h"
 
-#define TALER_TESTING_TRAIT_RESERVE_PRIVATE_KEY "reserve-private-key"
+#define TALER_TESTING_TRAIT_RESERVE_PRIVATE_KEY \
+  "reserve-private-key"
 
 /**
  * Obtain a reserve private key from a @a cmd.
  *
  * @param cmd command to extract trait from
- * @param selector which coin to pick if @a cmd has multiple on offer
+ * @param selector which coin to pick if @a cmd has multiple on
+ *        offer
  * @param reserve_priv[out] set to the private key of the reserve
  * @return #GNUNET_OK on success
  */
 int
-TALER_TESTING_get_trait_reserve_priv (const struct TALER_TESTING_Command *cmd,
-                                      unsigned int index,
-                                      struct TALER_ReservePrivateKeyP 
**reserve_priv)
+TALER_TESTING_get_trait_reserve_priv (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_ReservePrivateKeyP **reserve_priv)
 {
   return cmd->traits (cmd->cls,
                       (void **) reserve_priv,
@@ -50,8 +55,9 @@ TALER_TESTING_get_trait_reserve_priv (const struct 
TALER_TESTING_Command *cmd,
 
 
 struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_reserve_priv (unsigned int index,
-                                       const struct TALER_ReservePrivateKeyP 
*reserve_priv)
+TALER_TESTING_make_trait_reserve_priv (
+  unsigned int index,
+  const struct TALER_ReservePrivateKeyP *reserve_priv)
 {
   struct TALER_TESTING_Trait ret = {
     .index = index,
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 8979033..34f3217 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1309,4 +1309,53 @@ TALER_TESTING_make_trait_order_id
   (unsigned int index,
    const char *order_id);
 
+
+/**
+ * Obtain an amount from a @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which amount to pick if @a cmd has multiple
+ *        on offer
+ * @param amount[out] set to the amount
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_amount_obj (
+  const struct TALER_TESTING_Command *cmd,
+  unsigned int index,
+  struct TALER_Amount **amount);
+
+
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_amount_obj (
+  unsigned int index,
+  const struct TALER_Amount *amount);
+
+
+/**
+ * Obtain a hash code from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which hash code to pick if @a cmd has multiple on
+ *        offer
+ * @param wtid[out] set to the wanted hash code.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_hash
+  (const struct TALER_TESTING_Command *cmd,
+   unsigned int index,
+   struct GNUNET_HashCode **hash);
+
+/**
+ * @param index associate the hash code with this index
+ * @param hash which hash code should be returned
+ *
+ * @return the trait, to be put in the traits array of the command
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_hash
+  (unsigned int index,
+   struct GNUNET_HashCode *hash);
+
 #endif

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



reply via email to

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