Skip to content

Commit

Permalink
Added test case for #163
Browse files Browse the repository at this point in the history
  • Loading branch information
zik.saleeba committed Mar 16, 2013
1 parent 155291e commit 4e749ea
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
47 changes: 47 additions & 0 deletions tests/59_break_before_loop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <stdio.h>

void foo()
{
printf("foo\n");
}
int main()
{
int a,c;

printf("\nTest 1\n");

a = 0; c = 0;
while (1)
{
printf("a=%d\n", a++);
break;
for (c=0;c<10;c++)
printf("c=%d\n",c);
}

printf("\nTest 2\n");

a = 0; c = 0;
while (1)
{
printf("a=%d\n", a++);
break;
while (c < 3)
printf("c=%d\n",c++);
}

printf("\nTest 3\n");

a = 0; c = 0;
for (c=0;c<10;c++)
{
printf("c=%d\n",c);
foo();
break;
foo();
for (a = 0; a < 2; a++)
printf("a=%d\n",a);
}

return 0;
}
10 changes: 10 additions & 0 deletions tests/59_break_before_loop.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

Test 1
a=0

Test 2
a=0

Test 3
c=0
foo
3 changes: 2 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ TESTS= 00_assignment.test \
52_unnamed_enum.test \
54_goto.test \
55_array_initialiser.test \
56_cross_structure.test
56_cross_structure.test \
59_break_before_loop.test

%.test: %.expect %.c
@echo Test: $*...
Expand Down

0 comments on commit 4e749ea

Please sign in to comment.