From 85c285be79e75aaae135a3c1624408e872d607e5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 15 Jan 2020 22:29:09 +0100 Subject: clean up history building/checking logic a bit --- src/lib/testing_api_trait_number.c | 64 ++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'src/lib/testing_api_trait_number.c') diff --git a/src/lib/testing_api_trait_number.c b/src/lib/testing_api_trait_number.c index ff7741650..82aa34704 100644 --- a/src/lib/testing_api_trait_number.c +++ b/src/lib/testing_api_trait_number.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2018 Taler Systems SA + Copyright (C) 2018-2020 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 @@ -16,7 +16,6 @@ License along with TALER; see the file COPYING. If not, see */ - /** * @file exchange-lib/testing_api_trait_number.c * @brief traits to offer numbers @@ -31,6 +30,8 @@ #define TALER_TESTING_TRAIT_UINT "uint" #define TALER_TESTING_TRAIT_UINT64 "uint-64" +#define TALER_TESTING_TRAIT_BANK_ROW "bank-transaction-row" + /** * Obtain a number from @a cmd. @@ -41,10 +42,9 @@ * @return #GNUNET_OK on success. */ int -TALER_TESTING_get_trait_uint - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const unsigned int **n) +TALER_TESTING_get_trait_uint (const struct TALER_TESTING_Command *cmd, + unsigned int index, + const unsigned int **n) { return cmd->traits (cmd->cls, (const void **) n, @@ -61,9 +61,8 @@ TALER_TESTING_get_trait_uint * @return #GNUNET_OK on success. */ struct TALER_TESTING_Trait -TALER_TESTING_make_trait_uint - (unsigned int index, - const unsigned int *n) +TALER_TESTING_make_trait_uint (unsigned int index, + const unsigned int *n) { struct TALER_TESTING_Trait ret = { .index = index, @@ -84,10 +83,9 @@ TALER_TESTING_make_trait_uint * @return #GNUNET_OK on success. */ int -TALER_TESTING_get_trait_uint64 - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const uint64_t **n) +TALER_TESTING_get_trait_uint64 (const struct TALER_TESTING_Command *cmd, + unsigned int index, + const uint64_t **n) { return cmd->traits (cmd->cls, (const void **) n, @@ -103,9 +101,8 @@ TALER_TESTING_get_trait_uint64 * @param n number to offer. */ struct TALER_TESTING_Trait -TALER_TESTING_make_trait_uint64 - (unsigned int index, - const uint64_t *n) +TALER_TESTING_make_trait_uint64 (unsigned int index, + const uint64_t *n) { struct TALER_TESTING_Trait ret = { .index = index, @@ -116,4 +113,39 @@ TALER_TESTING_make_trait_uint64 } +/** + * Obtain a bank transaction row value from @a cmd. + * + * @param cmd command to extract the number from. + * @param row[out] set to the number coming from @a cmd. + * @return #GNUNET_OK on success. + */ +int +TALER_TESTING_get_trait_bank_row (const struct TALER_TESTING_Command *cmd, + const uint64_t **row) +{ + return cmd->traits (cmd->cls, + (const void **) row, + TALER_TESTING_TRAIT_BANK_ROW, + 0); +} + + +/** + * Offer bank transaction row trait. + * + * @param row number to offer. + */ +struct TALER_TESTING_Trait +TALER_TESTING_make_trait_bank_row (const uint64_t *row) +{ + struct TALER_TESTING_Trait ret = { + .index = 0, + .trait_name = TALER_TESTING_TRAIT_BANK_ROW, + .ptr = (const void *) row + }; + return ret; +} + + /* end of testing_api_trait_number.c */ -- cgit v1.2.3