Debian Codegraph @

suite/cstest/include/capstone_test.h

raw symbols SCIP
1 /* Capstone testing regression */
2 /* By Do Minh Tuan <[email protected]>, 02-2019 */
3
4
5 #ifndef CAPSTONE_TEST_H
6 #define CAPSTONE_TEST_H
7
8 #include <stdarg.h>
9 #include <stddef.h>
10 #include <setjmp.h>
11 #include <stdint.h>
12 #include <cmocka.h>
13 #include <stdlib.h>
14 #include <string.h>
15 #include <capstone/capstone.h>
16 #include "helper.h"
17 #include "factory.h"
18
19 #define cs_assert_err(expect, err) \
20 do { \
21 cs_err __err = err; \
22 if (__err != expect) { \
23 fail_msg("%s",cs_strerror(__err)); \
24 } \
25 } while (0)
26
27
28 #define cs_assert_success(err) cs_assert_err(CS_ERR_OK, err)
29
30
31 #define cs_assert_fail(err) \
32 do { \
33 cs_err __err = err; \
34 if (__err == CS_ERR_OK) { \
35 fail_msg("%s",cs_strerror(__err)); \
36 } \
37 } while (0)
38
39 #define NUMARCH 10
40 #define NUMMODE 35
41 #define NUMOPTION 41
42 #define MAXMEM 1024
43
44 typedef struct {
45 const char *str;
46 unsigned int value;
47 } single_dict;
48
49 typedef struct {
50 const char *str;
51 unsigned int first_value;
52 unsigned int second_value;
53 } double_dict;
54
55 extern char *(*function)(csh *, cs_mode, cs_insn*);
56
57 int get_index(double_dict d[], unsigned size, const char *str);
58 int get_value(single_dict d[], unsigned size, const char *str);
59 void test_single_MC(csh *handle, int mc_mode, char *line);
60 void test_single_issue(csh *handle, cs_mode mode, char *line, int detail);
61 int set_function(int arch);
62
63 #endif /* CAPSTONE_TEST_H */