1 #ifndef EXECUTE_TESTS_H
2 #define EXECUTE_TESTS_H
5 execute_tests.h -- header file for execute_tests.c
6 Copyright (C) 2018 Guus Sliepen <guus@meshlink.io>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "../common/mesh_event_handler.h"
27 const mesh_event_t *expected_events;
32 typedef bool (*test_step_func_t)(void);
34 int setup_test(void **state);
35 void execute_test(test_step_func_t step_func, void **state);
36 int teardown_test(void **state);
38 /// Changes the state of the node state machine.
39 /** This function changes the current state of the node
41 * @param status Pointer to status handle of that node.
42 * @param currentEv Current event triggered by the node.
44 * @return This function returns true if state change is successful else returns false
46 extern bool change_state(node_status_t *status, mesh_event_t currentEv);
48 /// Sends SIGIO signal to all the nodes in the container.
49 /** This function Triggers SIGIO signal to all the target applications running inside the container
51 * @param status Pointer to array of status handles of target nodes.
52 * @param start Starting index from which to start in the array.
53 * @param end Ending index of the array
54 * @param node_ids Pointer to array of node id strings
58 extern void signal_node_start(node_status_t *node_status, int start, int end, char *node_ids[]);
60 /// Checks for the completion of nodes state machines.
61 /** This function checks whether the nodes state machines have reached their maximum state indexes
63 * @param status Pointer to array of status handles of target nodes.
64 * @param length Number of nodes to check.
66 * @return This function returns true if all the nodes reached their max states
68 extern bool check_nodes_finished(node_status_t *node_status, int length);