2 test_cases_stop_close.c -- Execution of specific meshlink black box test cases
3 Copyright (C) 2018 Guus Sliepen <guus@meshlink.io>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "execute_tests.h"
25 #include "test_cases_stop_close.h"
26 #include "../common/containers.h"
27 #include "../common/test_step.h"
28 #include "../common/common_handlers.h"
37 #define CLOSE_FILE_PATH "/home/sairoop/meshlink/test/blackbox/test_case_close/mesh_close"
38 #define VALGRIND_LOG "valgrind.log"
40 static void test_case_mesh_close_01(void **state);
41 static bool test_steps_mesh_close_01(void);
42 static void test_case_mesh_stop_01(void **state);
43 static bool test_steps_mesh_stop_01(void);
45 /* State structure for meshlink_close Test Case #1 */
46 static black_box_state_t test_mesh_close_01_state = {
47 .test_case_name = "test_case_mesh_close_01",
50 /* State structure for meshlink_close Test Case #1 */
51 static black_box_state_t test_mesh_stop_01_state = {
52 .test_case_name = "test_case_mesh_stop_01",
55 /* Execute meshlink_close Test Case # 1*/
56 static void test_case_mesh_close_01(void **state) {
57 execute_test(test_steps_mesh_close_01, state);
60 /* Test Steps for meshlink_close Test Case # 1*/
62 static bool test_steps_mesh_close_01(void) {
64 assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
69 /* Execute meshlink_stop Test Case # 1*/
70 static void test_case_mesh_stop_01(void **state) {
71 execute_test(test_steps_mesh_stop_01, state);
74 /* Test Steps for meshlink_stop Test Case # 1*/
75 static bool test_steps_mesh_stop_01(void) {
77 assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
82 int test_meshlink_stop_close(void) {
83 const struct CMUnitTest blackbox_stop_close_tests[] = {
84 cmocka_unit_test_prestate_setup_teardown(test_case_mesh_stop_01, NULL, NULL,
85 (void *)&test_mesh_stop_01_state),
86 cmocka_unit_test_prestate_setup_teardown(test_case_mesh_close_01, NULL, NULL,
87 (void *)&test_mesh_close_01_state)
90 total_tests += sizeof(blackbox_stop_close_tests) / sizeof(blackbox_stop_close_tests[0]);
92 return cmocka_run_group_tests(blackbox_stop_close_tests, NULL, NULL);