#include #include #include #include #include "lv2_contexts.h" #define TEST_ASSERT(check) do {\ if (!(check)) {\ fprintf(stderr, "Failure at line %d: %s\n", __LINE__, #check);\ assert(false);\ _exit(1);\ }\ } while (0) #define NUM_PORTS 64 void print_flags(void* flags) { for (int i = NUM_PORTS; i >= 0; --i) printf((lv2_contexts_port_is_valid(flags, i)) ? "1" : "0"); printf("\n"); } int main() { uint64_t flags = 0; print_flags(&flags); lv2_contexts_set_port_valid(&flags, 16); print_flags(&flags); for (int i = 0; i < NUM_PORTS; ++i) { if (i == 16) { TEST_ASSERT(lv2_contexts_port_is_valid(&flags, i)); } else { TEST_ASSERT(!lv2_contexts_port_is_valid(&flags, i)); } } lv2_contexts_set_port_valid(&flags, 46); lv2_contexts_set_port_valid(&flags, 0); print_flags(&flags); for (int i = 0; i < NUM_PORTS; ++i) { if (i == 0 || i == 16 || i == 46) { TEST_ASSERT(lv2_contexts_port_is_valid(&flags, i)); } else { TEST_ASSERT(!lv2_contexts_port_is_valid(&flags, i)); } } lv2_contexts_unset_port_valid(&flags, 16); print_flags(&flags); for (int i = 0; i < NUM_PORTS; ++i) { if (i == 0 || i == 46) { TEST_ASSERT(lv2_contexts_port_is_valid(&flags, i)); } else { TEST_ASSERT(!lv2_contexts_port_is_valid(&flags, i)); } } return 0; } /about/?h=v1.2.0'>aboutsummaryrefslogtreecommitdiffstats
blob: 289e0ce54ea96b161974ab3e8ac3773e7a846263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88