on master help sign in
Add C file test
commite58b20f68d8b9ecedceaa03f3e78c560127c3527 authorMithil Poojary <mithil467@gmail.com> dateMon 5 Oct 2020, 04:28 (6 years ago) parent0ce697d
2 files changed+124
tests/syntax-tests/highlighted/C/test.c+62 tests/syntax-tests/source/C/test.c+62
tests/syntax-tests/highlighted/C/test.cnew file+62
@@ -0,0 +1,62 @@
1+#include <stdio.h>
2+#include <stdlib.h>
3+#include <stdbool.h>
4+
5+void test_function()
6+{
7+#define TEST
8+#ifdef TEST
9+ printf("TEST is defined\n");
10+#endif
11+}
12+
13+struct Node
14+{
15+ int val;
16+ struct Node *next;
17+};
18+
19+int main(int argc, char **argv)
20+{
21+ /* This C program was written to help bat
22+ * with its syntax highlighting tests
23+ */
24+
25+ // Calling test function
26+ test_function();
27+ struct Node *head = NULL;
28+ head = (struct Node *)malloc(sizeof(struct Node *));
29+ head->val = -1;
30+ if (head->val == 1 * -1)
31+ {
32+ head->val = 10;
33+ }
34+ else
35+ {
36+ head->val = argc;
37+ }
38+ int t = head->val, count = 0;
39+ free(head);
40+ while (t--)
41+ {
42+ count++;
43+ }
44+ for (int i = t; i < count; ++i)
45+ {
46+ do
47+ {
48+ --count;
49+ } while (false);
50+ }
51+ enum chars
52+ {
53+ M,
54+ I,
55+ T,
56+ H,
57+ L
58+ };
59+ char *string = "string";
60+ printf("true is #define true %d\n", true);
61+ return 0;
62+}
tests/syntax-tests/source/C/test.cnew file+62
@@ -0,0 +1,62 @@
1+#include <stdio.h>
2+#include <stdlib.h>
3+#include <stdbool.h>
4+
5+void test_function()
6+{
7+#define TEST
8+#ifdef TEST
9+ printf("TEST is defined\n");
10+#endif
11+}
12+
13+struct Node
14+{
15+ int val;
16+ struct Node *next;
17+};
18+
19+int main(int argc, char **argv)
20+{
21+ /* This C program was written to help bat
22+ * with its syntax highlighting tests
23+ */
24+
25+ // Calling test function
26+ test_function();
27+ struct Node *head = NULL;
28+ head = (struct Node *)malloc(sizeof(struct Node *));
29+ head->val = -1;
30+ if (head->val == 1 * -1)
31+ {
32+ head->val = 10;
33+ }
34+ else
35+ {
36+ head->val = argc;
37+ }
38+ int t = head->val, count = 0;
39+ free(head);
40+ while (t--)
41+ {
42+ count++;
43+ }
44+ for (int i = t; i < count; ++i)
45+ {
46+ do
47+ {
48+ --count;
49+ } while (false);
50+ }
51+ enum chars
52+ {
53+ M,
54+ I,
55+ T,
56+ H,
57+ L
58+ };
59+ char *string = "string";
60+ printf("true is #define true %d\n", true);
61+ return 0;
62+}