OpenVPN
test_assert_macros.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 #include <errno.h>
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 #ifdef HAVE_UNISTD_H
13 #include <unistd.h>
14 #endif
15 #include <fcntl.h>
16 
17 /**************************************
18  *** assert_return_code
19  **************************************/
20 static void test_assert_return_code(void **state)
21 {
22  struct stat sb;
23  int rc;
24 
25  (void)state; /* unused */
26 
27  rc = stat(".", &sb);
28  assert_return_code(rc, 0);
29 
30 #ifndef _MSC_VER
31  assert_true(S_ISDIR(sb.st_mode));
32 #endif
33 }
34 
35 int main(void) {
36  const struct CMUnitTest tests[] = {
38  };
39 
40  return cmocka_run_group_tests(tests, NULL, NULL);
41 }
#define assert_true(c)
Definition: cmocka.h:1045
#define cmocka_unit_test(f)
Initializes a CMUnitTest structure.
Definition: cmocka.h:1653
#define assert_return_code(rc, error)
Definition: cmocka.h:1082
static void test_assert_return_code(void **state)
int main(void)
#define cmocka_run_group_tests(group_tests, group_setup, group_teardown)
Definition: cmocka.h:1749