summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMithil Poojary <mithil467@gmail.com>2020-10-05 04:28:08 +0530
committerDavid Peter <sharkdp@users.noreply.github.com>2020-10-05 09:06:47 +0200
commite58b20f68d8b9ecedceaa03f3e78c560127c3527 (patch)
treed4e694cc898f87f8e49c11d412ebeba840865163 /tests
parent0ce697dabaeb387371087f3d8da8d3035ddc3d59 (diff)
Add C file test
Diffstat (limited to 'tests')
-rw-r--r--tests/syntax-tests/highlighted/C/test.c62
-rw-r--r--tests/syntax-tests/source/C/test.c62
2 files changed, 124 insertions, 0 deletions
diff --git a/tests/syntax-tests/highlighted/C/test.c b/tests/syntax-tests/highlighted/C/test.c
new file mode 100644
index 00000000..723e75a3
--- /dev/null
+++ b/tests/syntax-tests/highlighted/C/test.c
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+void test_function()
+{
+#define TEST
+#ifdef TEST
+ printf("TEST is defined\n");
+#endif
+}
+
+struct Node
+{
+ int val;
+ struct Node *next;
+};
+
+int main(int argc, char **argv)
+{
+ /* This C program was written to help bat
+ * with its syntax highlighting tests
+ */
+
+ // Calling test function
+ test_function();
+ struct Node *head = NULL;
+ head = (struct Node *)malloc(sizeof(struct Node *));
+ head->val = -1;
+ if (head->val == 1 * -1)
+ {
+ head->val = 10;
+ }
+ else
+ {
+ head->val = argc;
+ }
+ int t = head->val, count = 0;
+ free(head);
+ while (t--)
+ {
+ count++;
+ }
+ for (int i = t; i < count; ++i)
+ {
+ do
+ {
+ --count;
+ } while (false);
+ }
+ enum chars
+ {
+ M,
+ I,
+ T,
+ H,
+ L
+ };
+ char *string = "string";
+ printf("true is #define true %d\n", true);
+ return 0;
+}
diff --git a/tests/syntax-tests/source/C/test.c b/tests/syntax-tests/source/C/test.c
new file mode 100644
index 00000000..9ca7255d
--- /dev/null
+++ b/tests/syntax-tests/source/C/test.c
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+void test_function()
+{
+#define TEST
+#ifdef TEST
+ printf("TEST is defined\n");
+#endif
+}
+
+struct Node
+{
+ int val;
+ struct Node *next;
+};
+
+int main(int argc, char **argv)
+{
+ /* This C program was written to help bat
+ * with its syntax highlighting tests
+ */
+
+ // Calling test function
+ test_function();
+ struct Node *head = NULL;
+ head = (struct Node *)malloc(sizeof(struct Node *));
+ head->val = -1;
+ if (head->val == 1 * -1)
+ {
+ head->val = 10;
+ }
+ else
+ {
+ head->val = argc;
+ }
+ int t = head->val, count = 0;
+ free(head);
+ while (t--)
+ {
+ count++;
+ }
+ for (int i = t; i < count; ++i)
+ {
+ do
+ {
+ --count;
+ } while (false);
+ }
+ enum chars
+ {
+ M,
+ I,
+ T,
+ H,
+ L
+ };
+ char *string = "string";
+ printf("true is #define true %d\n", true);
+ return 0;
+}