diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-07-05 20:43:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-07-05 20:43:28 +0200 |
commit | 6de49ea2c02e311e5f5366005bd3497a9bb25187 (patch) | |
tree | a221b9c784b4e004eb5972e18516653d1aea6a5c /src/testing/testing_api_trait_number.c | |
parent | e428783e2e0295186dc4eae273df8a3f8b75df60 (diff) | |
parent | ed5b98a2c2308fbd44b906a30286d2689fd304dd (diff) | |
download | exchange-6de49ea2c02e311e5f5366005bd3497a9bb25187.tar.gz exchange-6de49ea2c02e311e5f5366005bd3497a9bb25187.tar.bz2 exchange-6de49ea2c02e311e5f5366005bd3497a9bb25187.zip |
Merge branch 'protocolv8'
Diffstat (limited to 'src/testing/testing_api_trait_number.c')
-rw-r--r-- | src/testing/testing_api_trait_number.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_number.c b/src/testing/testing_api_trait_number.c index 50ce6d8c7..ed25593ef 100644 --- a/src/testing/testing_api_trait_number.c +++ b/src/testing/testing_api_trait_number.c @@ -28,7 +28,9 @@ #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_INT64 "int-64" #define TALER_TESTING_TRAIT_BANK_ROW "bank-transaction-row" @@ -73,6 +75,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. * * @param cmd command to extract the number from. @@ -112,6 +153,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. * * @param cmd command to extract the number from. |