summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-28 21:45:46 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-28 21:45:46 +0100
commitbc57f007e44ee1634e7ccf617de3fb66b1dc34a5 (patch)
tree95209f7ea7a4f6282568112fe13833d63a4be1aa /src/testing
parent96c5cd4c4236551bf58c93621152d3bd08719da0 (diff)
downloadexchange-bc57f007e44ee1634e7ccf617de3fb66b1dc34a5.tar.gz
exchange-bc57f007e44ee1634e7ccf617de3fb66b1dc34a5.tar.bz2
exchange-bc57f007e44ee1634e7ccf617de3fb66b1dc34a5.zip
lookup in reverse order also inside of batch
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_loop.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 7c3a7aaa9..5bfb7fe0e 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -68,20 +68,29 @@ TALER_TESTING_interpreter_lookup_command (struct TALER_TESTING_Interpreter *is,
{
#define BATCH_INDEX 1
struct TALER_TESTING_Command *batch;
+ struct TALER_TESTING_Command *current;
+ const struct TALER_TESTING_Command *match;
+ current = TALER_TESTING_cmd_batch_get_current (cmd);
GNUNET_assert (GNUNET_OK ==
TALER_TESTING_get_trait_cmd (cmd,
BATCH_INDEX,
&batch));
+ /* We must do the loop forward, but we can find the last match */
+ match = NULL;
for (unsigned int j = 0;
NULL != (cmd = &batch[j])->label;
j++)
{
+ if (current == cmd)
+ break; /* do not go past current command */
if ( (NULL != cmd->label) &&
(0 == strcmp (cmd->label,
label)) )
- return cmd;
+ match = cmd;
}
+ if (NULL != match)
+ return match;
}
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,