diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2019-01-21 15:42:51 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2019-01-21 15:42:51 +0100 |
commit | 5f6236ec715410ddcfe3b0adf10f1f08b8aa1b91 (patch) | |
tree | d0c5aca1be71ed7b17c27808b29cd1e8622df0f0 | |
parent | 08eafb1add8c04fdd57eb4f43793b3377a9fb94c (diff) |
Provide internal command advancer to batch-CMD.
-rw-r--r-- | src/lib/testing_api_cmd_batch.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/lib/testing_api_cmd_batch.c b/src/lib/testing_api_cmd_batch.c index a56c959a0..b1a6a3e01 100644 --- a/src/lib/testing_api_cmd_batch.c +++ b/src/lib/testing_api_cmd_batch.c @@ -39,9 +39,9 @@ struct BatchState struct TALER_TESTING_Command *batch; /** - * Internal comand pointer. + * Internal command pointer. */ - int batch_ip; + unsigned int batch_ip; }; @@ -59,7 +59,6 @@ batch_run (void *cls, { struct BatchState *bs = cls; - bs->batch_ip++; if (NULL != bs->batch[bs->batch_ip].label) TALER_LOG_DEBUG ("Running batched command: %s\n", bs->batch[bs->batch_ip].label); @@ -157,7 +156,6 @@ TALER_TESTING_cmd_batch (const char *label, unsigned int i; bs = GNUNET_new (struct BatchState); - bs->batch_ip = -1; /* Get number of commands. */ for (i=0;NULL != batch[i].label;i++) @@ -181,6 +179,27 @@ TALER_TESTING_cmd_batch (const char *label, return cmd; } +/** + * Advance internal pointer to next command. + * + * @param is interpreter state. + */ +void +TALER_TESTING_cmd_batch_next + (struct TALER_TESTING_Interpreter *is) +{ + struct BatchState *bs = is->commands[is->ip].cls; + + if (NULL == bs->batch[bs->batch_ip].label) + { + is->ip++; + return; + } + + bs->batch_ip++; +} + + /** * Test if this command is a batch command. @@ -188,7 +207,8 @@ TALER_TESTING_cmd_batch (const char *label, * @return false if not, true if it is a batch command */ int -TALER_TESTING_cmd_is_batch (const struct TALER_TESTING_Command *cmd) +TALER_TESTING_cmd_is_batch + (const struct TALER_TESTING_Command *cmd) { return cmd->run == &batch_run; } @@ -200,7 +220,8 @@ TALER_TESTING_cmd_is_batch (const struct TALER_TESTING_Command *cmd) * @return cmd current batch command */ struct TALER_TESTING_Command * -TALER_TESTING_cmd_batch_get_current (const struct TALER_TESTING_Command *cmd) +TALER_TESTING_cmd_batch_get_current + (const struct TALER_TESTING_Command *cmd) { struct BatchState *bs = cmd->cls; |