summaryrefslogtreecommitdiff
path: root/src/include/sync_testing_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/sync_testing_lib.h')
-rw-r--r--src/include/sync_testing_lib.h134
1 files changed, 16 insertions, 118 deletions
diff --git a/src/include/sync_testing_lib.h b/src/include/sync_testing_lib.h
index 5a0d657..f0737de 100644
--- a/src/include/sync_testing_lib.h
+++ b/src/include/sync_testing_lib.h
@@ -29,124 +29,6 @@
#include <taler/taler_testing_lib.h>
#include <microhttpd.h>
-/**
- * Index used in #SYNC_TESTING_get_trait_hash() for the current hash.
- */
-#define SYNC_TESTING_TRAIT_HASH_CURRENT 0
-
-/**
- * Index used in #SYNC_TESTING_get_trait_hash() for the previous hash.
- */
-#define SYNC_TESTING_TRAIT_HASH_PREVIOUS 1
-
-
-/**
- * Obtain a hash from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index the number's index number, #SYNC_TESTING_TRAIT_HASH_CURRENT or
- * #SYNC_TESTING_TRAIT_HASH_PREVIOUS
- * @param h[out] set to the hash coming from @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-SYNC_TESTING_get_trait_hash (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_HashCode **h);
-
-
-/**
- * Offer a hash.
- *
- * @param index the number's index number.
- * @param h the hash to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-SYNC_TESTING_make_trait_hash (unsigned int index,
- const struct GNUNET_HashCode *h);
-
-
-/**
- * Obtain an account public key from @a cmd.
- *
- * @param cmd command to extract the public key from.
- * @param index usually 0
- * @param pub[out] set to the account public key used in @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-SYNC_TESTING_get_trait_account_pub (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct SYNC_AccountPublicKeyP **pub);
-
-
-/**
- * Offer an account public key.
- *
- * @param index usually zero
- * @param h the account_pub to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-SYNC_TESTING_make_trait_account_pub (unsigned int index,
- const struct SYNC_AccountPublicKeyP *h);
-
-
-/**
- * Obtain an account private key from @a cmd.
- *
- * @param cmd command to extract the number from.
- * @param index must be 0
- * @param priv[out] set to the account private key used in @a cmd.
- * @return #GNUNET_OK on success.
- */
-int
-SYNC_TESTING_get_trait_account_priv (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct
- SYNC_AccountPrivateKeyP **priv);
-
-
-/**
- * Offer an account private key.
- *
- * @param index usually zero
- * @param priv the account_priv to offer.
- * @return #GNUNET_OK on success.
- */
-struct TALER_TESTING_Trait
-SYNC_TESTING_make_trait_account_priv (unsigned int index,
- const struct
- SYNC_AccountPrivateKeyP *priv);
-
-
-/**
- * Start the sync backend process. Assume the port
- * is available and the database is clean. Use the "prepare
- * sync" function to do such tasks.
- *
- * @param config_filename configuration filename.
- *
- * @return the process, or NULL if the process could not
- * be started.
- */
-struct GNUNET_OS_Process *
-SYNC_TESTING_run_sync (const char *config_filename,
- const char *sync_url);
-
-
-/**
- * Prepare the sync execution. Create tables and check if
- * the port is available.
- *
- * @param config_filename configuration filename.
- * @return the base url, or NULL upon errors. Must be freed
- * by the caller.
- */
-char *
-SYNC_TESTING_prepare_sync (const char *config_filename);
-
/**
* Make the "backup download" command for a non-existent upload.
@@ -234,4 +116,20 @@ SYNC_TESTING_cmd_backup_upload (const char *label,
const void *backup_data,
size_t backup_data_size);
+/**
+ * Call @a op on all simple traits.
+ *
+ * @param op macro to call
+ */
+#define SYNC_TESTING_SIMPLE_TRAITS(op) \
+ op (account_pub, const struct SYNC_AccountPublicKeyP) \
+ op (account_priv, const struct SYNC_AccountPrivateKeyP) \
+ op (prev_hash, const struct GNUNET_HashCode) \
+ op (curr_hash, const struct GNUNET_HashCode)
+
+
+/* FIXME: eventually switch to libgnunettesting with the SYNC_ prefix for
+ the symbols instead of TALER_TESTING_! */
+SYNC_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT)
+
#endif