diff options
Diffstat (limited to 'src/testing/testing.h')
-rw-r--r-- | src/testing/testing.h | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/testing/testing.h b/src/testing/testing.h index b12466530..8aba09e4b 100644 --- a/src/testing/testing.h +++ b/src/testing/testing.h | |||
@@ -21,54 +21,54 @@ | |||
21 | /** | 21 | /** |
22 | * @author t3sserakt | 22 | * @author t3sserakt |
23 | */ | 23 | */ |
24 | 24 | #ifndef TESTING_H | |
25 | #define TESTING_H | ||
25 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
26 | 27 | ||
28 | |||
29 | /** | ||
30 | * Advance internal pointer to next command. | ||
31 | * | ||
32 | * @param cls batch internal state | ||
33 | * @return true if we could advance, false if the batch | ||
34 | * has completed and cannot advance anymore | ||
35 | */ | ||
36 | bool | ||
37 | GNUNET_TESTING_cmd_batch_next_ (void *cls); | ||
38 | |||
39 | |||
40 | /** | ||
41 | * Test if this command is a batch command. | ||
42 | * | ||
43 | * @return false if not, true if it is a batch command | ||
44 | */ | ||
45 | bool | ||
46 | GNUNET_TESTING_cmd_is_batch_ (const struct GNUNET_TESTING_Command *cmd); | ||
47 | |||
48 | |||
49 | /** | ||
50 | * Obtain what command the batch is at. | ||
51 | * | ||
52 | * @return cmd current batch command | ||
53 | */ | ||
54 | struct GNUNET_TESTING_Command * | ||
55 | GNUNET_TESTING_cmd_batch_get_current_ (const struct GNUNET_TESTING_Command *cmd); | ||
56 | |||
57 | |||
27 | /** | 58 | /** |
28 | * Global state of the interpreter, used by a command | 59 | * Set what command the batch should be at. Needed for |
29 | * to access information about other commands. | 60 | * loops. We may want to change this to take a label |
61 | * and/or expose it in the public API in the future. | ||
62 | * Not used for now. | ||
63 | * | ||
64 | * @param cmd current batch command | ||
65 | * @param new_ip where to move the IP | ||
30 | */ | 66 | */ |
31 | // SUGGESTION: consider making this struct opaque (only known inside of libgnunettesting, | 67 | void |
32 | // say main loop and a few select commands, like next/fail/batch); + helper | 68 | GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd, |
33 | // function to access 'cfg'? | 69 | unsigned int new_ip); |
34 | struct GNUNET_TESTING_Interpreter | 70 | |
35 | { | 71 | |
36 | 72 | ||
37 | /** | 73 | |
38 | * Commands the interpreter will run. | 74 | #endif |
39 | */ | ||
40 | struct GNUNET_TESTING_Command *commands; | ||
41 | |||
42 | /** | ||
43 | * Interpreter task (if one is scheduled). | ||
44 | */ | ||
45 | struct GNUNET_SCHEDULER_Task *task; | ||
46 | |||
47 | /** | ||
48 | * Finish task of a blocking call to a commands finish method. | ||
49 | */ | ||
50 | struct GNUNET_SCHEDULER_Task *finish_task; | ||
51 | |||
52 | /** | ||
53 | * Our configuration. | ||
54 | */ | ||
55 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
56 | |||
57 | /** | ||
58 | * Task run on timeout. | ||
59 | */ | ||
60 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
61 | |||
62 | /** | ||
63 | * Instruction pointer. Tells #interpreter_run() which instruction to run | ||
64 | * next. Need (signed) int because it gets -1 when rewinding the | ||
65 | * interpreter to the first CMD. | ||
66 | */ | ||
67 | int ip; | ||
68 | |||
69 | /** | ||
70 | * Result of the testcases, #GNUNET_OK on success | ||
71 | */ | ||
72 | int result; | ||
73 | |||
74 | }; | ||