2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-18 15:26:16 +00:00

Add C file test

This commit is contained in:
Mithil Poojary 2020-10-05 04:28:08 +05:30 committed by David Peter
parent 0ce697daba
commit e58b20f68d
2 changed files with 124 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}