Skip to content

Commit b6778fb

Browse files
johanjinoalvi-codes
andcommitted
Time to start our own tests 😎
Co-Authored-By: Sohailul Islam Alvi <[email protected]>
1 parent fe3c07a commit b6778fb

8 files changed

+86
-0
lines changed

compiler_tests/_custom/for_break.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
int f()
2+
{
3+
int i;
4+
for(i=0; i<10; i++){
5+
if (i==5){
6+
break;
7+
}
8+
}
9+
return i;
10+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdio.h>
2+
3+
int f();
4+
5+
int main()
6+
{
7+
int val = f();
8+
printf("The value returned: %d", val);
9+
return !( 5 == val);
10+
}

compiler_tests/_custom/for_continue.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
int f()
2+
{
3+
int y = 0;
4+
for(int i=0; i<10; i++){
5+
if (i>=5){
6+
continue;
7+
}
8+
++y;
9+
}
10+
return y;
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdio.h>
2+
3+
int f();
4+
5+
int main()
6+
{
7+
int val = f();
8+
printf("The value returned: %d", val);
9+
return !( 5 == val);
10+
}

compiler_tests/_custom/while_break.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
int f()
2+
{
3+
int i = 0;
4+
while(i<10){
5+
if (i==5){
6+
break;
7+
}
8+
i++;
9+
}
10+
return i;
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdio.h>
2+
3+
int f();
4+
5+
int main()
6+
{
7+
int val = f();
8+
printf("The value returned: %d", val);
9+
return !( 5 == val);
10+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int f()
2+
{
3+
int y = 0;
4+
int i = 0;
5+
while(i<10){
6+
if (i>=5){
7+
i++;
8+
continue;
9+
}
10+
++y;
11+
i++;
12+
}
13+
return y;
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdio.h>
2+
3+
int f();
4+
5+
int main()
6+
{
7+
int val = f();
8+
printf("The value returned: %d", val);
9+
return !( 5 == val);
10+
}

0 commit comments

Comments
 (0)