gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] 01/05: Put lookup logic for meta-commands.


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] 01/05: Put lookup logic for meta-commands.
Date: Wed, 20 Jun 2018 22:20:55 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository exchange.

commit 61fecfcd6f3e2e66e136c22195c38c99be8baa31
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jun 20 11:08:56 2018 +0200

    Put lookup logic for meta-commands.
---
 src/exchange-lib/testing_api_loop.c | 24 +++++++++++++++++++++++-
 src/include/taler_testing_lib.h     |  9 +++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/exchange-lib/testing_api_loop.c 
b/src/exchange-lib/testing_api_loop.c
index 7efadb3..0348506 100644
--- a/src/exchange-lib/testing_api_loop.c
+++ b/src/exchange-lib/testing_api_loop.c
@@ -57,11 +57,33 @@ TALER_TESTING_interpreter_lookup_command
                 "Attempt to lookup command for empty label\n");
     return NULL;
   }
-  for (unsigned int i=0;NULL != (cmd = &is->commands[i])->label;i++)
+  for (unsigned int i=0;
+       NULL != (cmd = &is->commands[i])->label;
+       i++)
+  {
+    /* Give precedence to top-level commands.  */
     if ( (NULL != cmd->label) &&
          (0 == strcmp (cmd->label,
                        label)) )
       return cmd;
+
+    if (GNUNET_YES == cmd->meta)
+    {
+      struct TALER_TESTING_Command *batch = cmd->cls;
+
+      /* NOTE: the batch does need a "end" CMD in the
+       * last place.  */
+      for (unsigned int i=0;
+           NULL != (cmd = &batch[i])->label;
+           i++) 
+      {
+        if ( (NULL != cmd->label) &&
+            (0 == strcmp (cmd->label,
+                          label)) )
+          return cmd;
+      }
+    }
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "Command not found: %s\n",
               label);
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 428bcb7..57e2f0d 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -300,6 +300,15 @@ struct TALER_TESTING_Command
             const char *trait,
             unsigned int index);
 
+
+  /**
+   * Has GNUNET_YES if the command is a "meta" one.  Meta
+   * commands are those that takes arrays of commands and
+   * execute them.  Are used to group testing commands in
+   * order to improve readability of test cases.
+   */
+  unsigned int meta;
+
 };
 
 /**

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]