summaryrefslogtreecommitdiff
path: root/src/exchange-lib/testing_api_trait_number.c
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-02-22 14:51:12 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-02-26 14:12:46 +0100
commitb593d416d6e788b2053c2f5ebb634e0bb39fe560 (patch)
treecf08a83fb1922c32d4a0e4ce161ae3ff20023a69 /src/exchange-lib/testing_api_trait_number.c
parent8d5cc9f550da58610ad220d72f21d930c47ad0a8 (diff)
downloadexchange-b593d416d6e788b2053c2f5ebb634e0bb39fe560.tar.gz
exchange-b593d416d6e788b2053c2f5ebb634e0bb39fe560.tar.bz2
exchange-b593d416d6e788b2053c2f5ebb634e0bb39fe560.zip
Bank-lib tests, using the new (libraries-based) style.
Diffstat (limited to 'src/exchange-lib/testing_api_trait_number.c')
-rw-r--r--src/exchange-lib/testing_api_trait_number.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/src/exchange-lib/testing_api_trait_number.c b/src/exchange-lib/testing_api_trait_number.c
index 8f011dca..4db88792 100644
--- a/src/exchange-lib/testing_api_trait_number.c
+++ b/src/exchange-lib/testing_api_trait_number.c
@@ -29,7 +29,8 @@
#include "taler_signatures.h"
#include "taler_testing_lib.h"
-#define TALER_TESTING_TRAIT_NUMBER "number"
+#define TALER_TESTING_TRAIT_UINT "uint"
+#define TALER_TESTING_TRAIT_UINT64 "uint-64"
/**
* Obtain a "number" value from @a cmd.
@@ -48,7 +49,7 @@ TALER_TESTING_get_trait_uint
{
return cmd->traits (cmd->cls,
(void **) n,
- TALER_TESTING_TRAIT_NUMBER,
+ TALER_TESTING_TRAIT_UINT,
index);
}
@@ -65,10 +66,52 @@ TALER_TESTING_make_trait_uint
{
struct TALER_TESTING_Trait ret = {
.index = index,
- .trait_name = TALER_TESTING_TRAIT_NUMBER,
+ .trait_name = TALER_TESTING_TRAIT_UINT,
.ptr = (const void *) n
};
return ret;
}
+/**
+ * Obtain a "number" value from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param selector which coin to pick if @a cmd has multiple on
+ * offer
+ * @param n[out] set to the number coming from @a cmd.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_uint64
+ (const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const uint64_t **n)
+{
+ return cmd->traits (cmd->cls,
+ (void **) n,
+ TALER_TESTING_TRAIT_UINT64,
+ index);
+}
+
+/**
+ * @param selector associate the object with this "tag"
+ * @param n which object should be returned
+ *
+ * @return the trait, to be put in the traits array of the command
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_uint64
+ (unsigned int index,
+ const uint64_t *n)
+{
+ struct TALER_TESTING_Trait ret = {
+ .index = index,
+ .trait_name = TALER_TESTING_TRAIT_UINT64,
+ .ptr = (const void *) n
+ };
+ return ret;
+}
+
+
+
/* end of testing_api_trait_number.c */