Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlfaultinjection / repo / third_party / cstyle / repo / tests / missing-space-around-braces.mm
1 #include <stdbool.h>
2 #include <stdint.h>
3
4 // Positive tests: these should generate a violation
5
6 // Arrays
7
8 // Missing space around opening brace
9
10 static const uint8_t sOctets_1[] = {0x01, 0x02 };
11 static const uint8_t sOctets_2[] ={0x01, 0x02 };
12 static const uint8_t sOctets_3[] ={ 0x01, 0x02 };
13 static const uint8_t sOctets_4[] =      {0x01, 0x02     };
14 static const uint8_t sOctets_5[] ={0x01, 0x02   };
15 static const uint8_t sOctets_6[] ={     0x01, 0x02      };
16
17 // Missing space around closing brace
18
19 static const uint8_t sOctets_7[] = { 0x01, 0x02};
20 static const uint8_t sOctets_8[] =      {       0x01, 0x02};
21
22 // Classes
23
24 class class_1 {};
25
26 class class_2{ };
27
28 class class_3{
29 };
30
31 // Structures
32
33 struct struct_1 {};
34
35 struct struct_2{ };
36
37 struct struct_3{
38 };
39
40 // Enumerations
41
42 enum enum_1 {};
43
44 enum enum_2{ };
45
46 enum enum_3{
47 };
48
49 // Namespaces
50
51 namespace namespace_1{};
52
53 namespace namespace_1{
54 };
55
56 namespace namespace_1{namespace namespace_2{};};
57
58 namespace namespace_1{
59
60 namespace namespace_2{};
61 };
62
63 // Functions / Methods
64
65 static int test_func_1(void){return 0; }
66 static int test_func_2(void){ return 0;}
67 static inline bool test_func_3(void){
68     return false; }
69 static inline bool test_func_4(void) {
70     return false;}
71 static inline void test_func_5(void)
72 {int a;
73     return;
74 }
75
76 // Nested Initializers
77
78 struct test_struct_5 {
79     int m_a;
80     bool m_b;
81 };
82
83 struct test_struct_6 {
84     struct test_struct_5 m_a;
85     bool m_b;
86 };
87
88 static const struct test_struct_6 sTestStruct6[] =
89     {{{ 0, true }, true }, {{ 1, false}, true }};
90
91 // Control Structures
92
93 static void test_control_structures(void)
94 {
95     int a = 0;
96     int i = 0;
97
98     if (true){a = a + 1;}
99
100     if (false){
101         a = a - 1;
102     }
103
104     if (a == 0) {
105         a = a + 1;
106     }else{
107         a = a - 1;}
108
109     if (a == 1) {
110         a = a * 2;
111     }else if (a == 2){
112         a = a / 2;
113     }
114
115     while (a > 0){
116         a -= 1;}
117
118     do{ a += 1; }while (a < 0);
119
120     for (i = 0; i < a; i++){
121         a--;}
122
123     switch (a){case 0: a += 1;}
124
125     switch (a){
126
127     case 2: a *= 2;
128
129     }
130
131     switch (a){
132
133     case 1: a -= 1;}
134 }
135
136 // Negative tests: these should not generate a violation
137
138 // None for now