testing traits for uint32_t and GNUNET_TIME_Relative
This commit is contained in:
parent
25ecc97717
commit
f2ec9c08b0
@ -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
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user