OpenVPN
test_ordering.c
Go to the documentation of this file.
1 #include "config.h"
2 
3 #include <stdarg.h>
4 #include <stddef.h>
5 #include <setjmp.h>
6 #include <cmocka.h>
7 #include <cmocka_private.h>
8 
9 static void mock_test_a_called(void)
10 {
12 }
13 
14 static void mock_test_b_called(void)
15 {
17 }
18 
19 static void mock_test_c_called(void)
20 {
22 }
23 
24 
25 static void test_does_succeed_for_expected(void **state)
26 {
27  (void)state;
30 
33 }
34 
35 static void test_does_succeed_for_multiple_calls(void **state)
36 {
37  (void)state;
41 
46 }
47 
48 static void test_ordering_does_ignore_calls(void **state)
49 {
50  (void)state;
51 
53 
57 }
58 
59 static void test_ordering_does_ignore_no_calls(void **state)
60 {
61  (void)state;
63 }
64 
66 {
67  (void)state;
69 
73 }
74 
76 {
77  (void)state;
81 
85 }
86 
88 {
89  (void)state;
93 
94 
98 }
99 
100 int main(void) {
101  const struct CMUnitTest tests[] = {
109  };
110 
111  return cmocka_run_group_tests(tests, NULL, NULL);
112 }
#define cmocka_unit_test(f)
Initializes a CMUnitTest structure.
Definition: cmocka.h:1653
static void test_ordering_does_expect_at_least_one_call(void **state)
Definition: test_ordering.c:65
static void mock_test_b_called(void)
Definition: test_ordering.c:14
int main(void)
static void mock_test_a_called(void)
Definition: test_ordering.c:9
static void test_does_succeed_for_multiple_calls(void **state)
Definition: test_ordering.c:35
static void test_ordering_ignores_out_of_order_properly(void **state)
Definition: test_ordering.c:87
#define expect_function_calls(function, times)
Definition: cmocka.h:1450
#define expect_function_call_any(function)
Definition: cmocka.h:1479
static void test_ordering_does_ignore_no_calls(void **state)
Definition: test_ordering.c:59
#define function_called()
Definition: cmocka.h:1434
static void test_ordering_does_work_across_different_functions(void **state)
Definition: test_ordering.c:75
#define expect_function_call(function)
Definition: cmocka.h:1465
static void mock_test_c_called(void)
Definition: test_ordering.c:19
#define cmocka_run_group_tests(group_tests, group_setup, group_teardown)
Definition: cmocka.h:1749
static void test_ordering_does_ignore_calls(void **state)
Definition: test_ordering.c:48
static void test_does_succeed_for_expected(void **state)
Definition: test_ordering.c:25
#define ignore_function_calls(function)
Definition: cmocka.h:1493