gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 138/152: traits for int64_t and json_t


From: gnunet
Subject: [taler-exchange] 138/152: traits for int64_t and json_t
Date: Sun, 05 Jul 2020 20:48:14 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

commit e01bcbb2d4d7922829da20a75b4b18ffa8b1c374
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Mon Jun 22 16:04:54 2020 -0400

    traits for int64_t and json_t
---
 src/include/taler_testing_lib.h        | 52 ++++++++++++++++++++++++++++++++++
 src/testing/testing_api_trait_json.c   | 42 +++++++++++++++++++++++++++
 src/testing/testing_api_trait_number.c | 40 ++++++++++++++++++++++++++
 3 files changed, 134 insertions(+)

diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 3402b1ea..3f834657 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2387,6 +2387,31 @@ TALER_TESTING_get_trait_uint64 (const struct 
TALER_TESTING_Command *cmd,
                                 const uint64_t **n);
 
 
+/**
+ * Offer number trait, 64-bit signed version.
+ *
+ * @param index the number's index number.
+ * @param n number to offer.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_int64 (unsigned int index,
+                                const int64_t *n);
+
+
+/**
+ * Obtain a "number" value from @a cmd, 64-bit signed version.
+ *
+ * @param cmd command to extract the number from.
+ * @param index the number's index number.
+ * @param[out] n set to the number coming from @a cmd.
+ * @return #GNUNET_OK on success.
+ */
+int
+TALER_TESTING_get_trait_int64 (const struct TALER_TESTING_Command *cmd,
+                               unsigned int index,
+                               const int64_t **n);
+
+
 /**
  * Offer a number.
  *
@@ -2536,6 +2561,33 @@ TALER_TESTING_make_trait_exchange_keys (unsigned int 
index,
                                         const json_t *keys);
 
 
+/**
+ * Obtain json from @a cmd.
+ *
+ * @param cmd command to extract the json from.
+ * @param index index number associate with the json on offer.
+ * @param[out] json where to write the json.
+ * @return #GNUNET_OK on success.
+ */
+int
+TALER_TESTING_get_trait_json (const struct TALER_TESTING_Command *cmd,
+                              unsigned int index,
+                              const json_t **json);
+
+
+/**
+ * Offer json in a trait.
+ *
+ * @param index index number associate with the json
+ *        on offer.
+ * @param json json to offer.
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_json (unsigned int index,
+                               const json_t *json);
+
+
 /**
  * Obtain a private key from a "merchant".  Used e.g. to obtain
  * a merchant's priv to sign a /track request.
diff --git a/src/testing/testing_api_trait_json.c 
b/src/testing/testing_api_trait_json.c
index cbddad53..e12f1e9a 100644
--- a/src/testing/testing_api_trait_json.c
+++ b/src/testing/testing_api_trait_json.c
@@ -30,6 +30,7 @@
 
 #define TALER_TESTING_TRAIT_WIRE_DETAILS "wire-details"
 #define TALER_TESTING_TRAIT_EXCHANGE_KEYS "exchange-keys"
+#define TALER_TESTING_TRAIT_JSON "json"
 
 /**
  * Obtain serialized exchange keys from @a cmd.
@@ -120,4 +121,45 @@ TALER_TESTING_make_trait_wire_details
 }
 
 
+/**
+ * Obtain json from @a cmd.
+ *
+ * @param cmd command to extract the json from.
+ * @param index index number associate with the json on offer.
+ * @param[out] json where to write the json.
+ * @return #GNUNET_OK on success.
+ */
+int
+TALER_TESTING_get_trait_json (const struct TALER_TESTING_Command *cmd,
+                              unsigned int index,
+                              const json_t **json)
+{
+  return cmd->traits (cmd->cls,
+                      (const void **) json,
+                      TALER_TESTING_TRAIT_JSON,
+                      index);
+}
+
+
+/**
+ * Offer json in a trait.
+ *
+ * @param index index number associate with the json
+ *        on offer.
+ * @param json json to offer.
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_json (unsigned int index,
+                               const json_t *json)
+{
+  struct TALER_TESTING_Trait ret = {
+    .index = index,
+    .trait_name = TALER_TESTING_TRAIT_JSON,
+    .ptr = (const json_t *) json
+  };
+  return ret;
+}
+
+
 /* end of testing_api_trait_json.c */
diff --git a/src/testing/testing_api_trait_number.c 
b/src/testing/testing_api_trait_number.c
index bf8cd3c2..ed25593e 100644
--- a/src/testing/testing_api_trait_number.c
+++ b/src/testing/testing_api_trait_number.c
@@ -30,6 +30,7 @@
 #define TALER_TESTING_TRAIT_UINT "uint"
 #define TALER_TESTING_TRAIT_UINT32 "uint-32"
 #define TALER_TESTING_TRAIT_UINT64 "uint-64"
+#define TALER_TESTING_TRAIT_INT64 "int-64"
 #define TALER_TESTING_TRAIT_BANK_ROW "bank-transaction-row"
 
 
@@ -151,6 +152,45 @@ TALER_TESTING_make_trait_uint64 (unsigned int index,
 }
 
 
+/**
+ * Obtain a "number" value from @a cmd, 64-bit signed version.
+ *
+ * @param cmd command to extract the number from.
+ * @param index the number's index number.
+ * @param[out] n set to the number coming from @a cmd.
+ * @return #GNUNET_OK on success.
+ */
+int
+TALER_TESTING_get_trait_int64 (const struct TALER_TESTING_Command *cmd,
+                               unsigned int index,
+                               const int64_t **n)
+{
+  return cmd->traits (cmd->cls,
+                      (const void **) n,
+                      TALER_TESTING_TRAIT_INT64,
+                      index);
+}
+
+
+/**
+ * Offer number trait, 64-bit signed version.
+ *
+ * @param index the number's index number.
+ * @param n number to offer.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_int64 (unsigned int index,
+                                const int64_t *n)
+{
+  struct TALER_TESTING_Trait ret = {
+    .index = index,
+    .trait_name = TALER_TESTING_TRAIT_INT64,
+    .ptr = (const void *) n
+  };
+  return ret;
+}
+
+
 /**
  * Obtain a bank transaction row value from @a cmd.
  *

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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