[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 137/152: testing traits for uint32_t and GNUNET_TIME_Re
From: |
gnunet |
Subject: |
[taler-exchange] 137/152: testing traits for uint32_t and GNUNET_TIME_Relative |
Date: |
Sun, 05 Jul 2020 20:48:13 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit f2ec9c08b024dc1ee3dc2cd968d928e2672bc214
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Mon Jun 22 03:13:10 2020 -0400
testing traits for uint32_t and GNUNET_TIME_Relative
---
src/include/taler_testing_lib.h | 54 ++++++++++++++++++++++++++++++++++
src/testing/testing_api_trait_number.c | 40 +++++++++++++++++++++++++
src/testing/testing_api_trait_time.c | 44 +++++++++++++++++++++++++++
3 files changed, 138 insertions(+)
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 0cab44d9..3402b1ea 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2337,6 +2337,31 @@ TALER_TESTING_make_trait_denom_sig (
const struct TALER_DenominationSignature *sig);
+/**
+ * Offer number trait, 32-bit version.
+ *
+ * @param index the number's index number.
+ * @param n number to offer.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_uint32 (unsigned int index,
+ const uint32_t *n);
+
+
+/**
+ * Obtain a "number" value from @a cmd, 32-bit 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_uint32 (const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const uint32_t **n);
+
+
/**
* Offer number trait, 64-bit version.
*
@@ -2852,4 +2877,33 @@ TALER_TESTING_make_trait_absolute_time (
unsigned int index,
const struct GNUNET_TIME_Absolute *time);
+
+/**
+ * Obtain a relative time from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which time to pick if
+ * @a cmd has multiple on offer.
+ * @param[out] time set to the wanted WTID.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_relative_time (
+ const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const struct GNUNET_TIME_Relative **time);
+
+
+/**
+ * Offer a relative time.
+ *
+ * @param index associate the object with this index
+ * @param time which object should be returned
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_relative_time (
+ unsigned int index,
+ const struct GNUNET_TIME_Relative *time);
+
#endif
diff --git a/src/testing/testing_api_trait_number.c
b/src/testing/testing_api_trait_number.c
index 50ce6d8c..bf8cd3c2 100644
--- a/src/testing/testing_api_trait_number.c
+++ b/src/testing/testing_api_trait_number.c
@@ -28,6 +28,7 @@
#include "taler_testing_lib.h"
#define TALER_TESTING_TRAIT_UINT "uint"
+#define TALER_TESTING_TRAIT_UINT32 "uint-32"
#define TALER_TESTING_TRAIT_UINT64 "uint-64"
#define TALER_TESTING_TRAIT_BANK_ROW "bank-transaction-row"
@@ -72,6 +73,45 @@ TALER_TESTING_make_trait_uint (unsigned int index,
}
+/**
+ * Obtain a "number" value from @a cmd, 32-bit 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_uint32 (const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const uint32_t **n)
+{
+ return cmd->traits (cmd->cls,
+ (const void **) n,
+ TALER_TESTING_TRAIT_UINT32,
+ index);
+}
+
+
+/**
+ * Offer number trait, 32-bit version.
+ *
+ * @param index the number's index number.
+ * @param n number to offer.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_uint32 (unsigned int index,
+ const uint32_t *n)
+{
+ struct TALER_TESTING_Trait ret = {
+ .index = index,
+ .trait_name = TALER_TESTING_TRAIT_UINT32,
+ .ptr = (const void *) n
+ };
+ return ret;
+}
+
+
/**
* Obtain a "number" value from @a cmd, 64-bit version.
*
diff --git a/src/testing/testing_api_trait_time.c
b/src/testing/testing_api_trait_time.c
index c77489bf..207246be 100644
--- a/src/testing/testing_api_trait_time.c
+++ b/src/testing/testing_api_trait_time.c
@@ -29,6 +29,7 @@
#include "taler_testing_lib.h"
#define TALER_TESTING_TRAIT_TIME_ABS "time-abs"
+#define TALER_TESTING_TRAIT_TIME_REL "time-rel"
/**
* Obtain a absolute time from @a cmd.
@@ -73,4 +74,47 @@ TALER_TESTING_make_trait_absolute_time
}
+/**
+ * Obtain a relative time from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which time to pick if
+ * @a cmd has multiple on offer.
+ * @param[out] time set to the wanted WTID.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_relative_time (
+ const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const struct GNUNET_TIME_Relative **time)
+{
+ return cmd->traits (cmd->cls,
+ (const void **) time,
+ TALER_TESTING_TRAIT_TIME_REL,
+ index);
+}
+
+
+/**
+ * Offer a relative time.
+ *
+ * @param index associate the object with this index
+ * @param time which object should be returned
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_relative_time (
+ unsigned int index,
+ const struct GNUNET_TIME_Relative *time)
+{
+ struct TALER_TESTING_Trait ret = {
+ .index = index,
+ .trait_name = TALER_TESTING_TRAIT_TIME_REL,
+ .ptr = (const void *) time
+ };
+ return ret;
+}
+
+
/* end of testing_api_trait_time.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] 128/152: update gana, (continued)
- [taler-exchange] 128/152: update gana, gnunet, 2020/07/05
- [taler-exchange] 131/152: moved yna to exchange, gnunet, 2020/07/05
- [taler-exchange] 140/152: synchronize with latest GANA, gnunet, 2020/07/05
- [taler-exchange] 146/152: expand justifications / agree with append-only log, gnunet, 2020/07/05
- [taler-exchange] 109/152: update exchange API to return struct instead of lots of individual args for TALER_EXCHANGE_transfers_get() -- simplifies merchant later, gnunet, 2020/07/05
- [taler-exchange] 119/152: ecs, gnunet, 2020/07/05
- [taler-exchange] 111/152: modify TALER_EXCHANGE_deposits_get() API to avoid NULL pointers and need for deep copies, gnunet, 2020/07/05
- [taler-exchange] 127/152: do init submodules, gnunet, 2020/07/05
- [taler-exchange] 130/152: sync gana, gnunet, 2020/07/05
- [taler-exchange] 122/152: created taler_sq_lib, gnunet, 2020/07/05
- [taler-exchange] 137/152: testing traits for uint32_t and GNUNET_TIME_Relative,
gnunet <=
- [taler-exchange] 136/152: add TALER_MHD_parse_internal_json_data(), gnunet, 2020/07/05
- [taler-exchange] 93/152: update exchange API to return struct instead of lots of individual args for TALER_EXCHANGE_transfers_get() -- simplifies merchant later, gnunet, 2020/07/05
- [taler-exchange] 139/152: clarify with/without wire fee issue, sanity checks on currencies, gnunet, 2020/07/05
- [taler-exchange] 143/152: bump required version, gnunet, 2020/07/05
- [taler-exchange] 150/152: merge, gnunet, 2020/07/05
- [taler-exchange] 149/152: fix error reporting/handling, gnunet, 2020/07/05
- [taler-exchange] 129/152: update gana, gnunet, 2020/07/05
- [taler-exchange] 148/152: move rewind command to exchange, add proper support for rewinding in batches, modify API to rewind to label, gnunet, 2020/07/05
- [taler-exchange] 145/152: minor typo, gnunet, 2020/07/05
- [taler-exchange] 133/152: synchronize with latest GANA, gnunet, 2020/07/05