Added test case for #163
git-svn-id: http://picoc.googlecode.com/svn/trunk@595 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
37ada79ac9
commit
b0455d52e4
47
tests/59_break_before_loop.c
Normal file
47
tests/59_break_before_loop.c
Normal file
|
@ -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
tests/59_break_before_loop.expect
Normal file
10
tests/59_break_before_loop.expect
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
Test 1
|
||||||
|
a=0
|
||||||
|
|
||||||
|
Test 2
|
||||||
|
a=0
|
||||||
|
|
||||||
|
Test 3
|
||||||
|
c=0
|
||||||
|
foo
|
|
@ -50,7 +50,8 @@ TESTS= 00_assignment.test \
|
||||||
52_unnamed_enum.test \
|
52_unnamed_enum.test \
|
||||||
54_goto.test \
|
54_goto.test \
|
||||||
55_array_initialiser.test \
|
55_array_initialiser.test \
|
||||||
56_cross_structure.test
|
56_cross_structure.test \
|
||||||
|
59_break_before_loop.test
|
||||||
|
|
||||||
%.test: %.expect %.c
|
%.test: %.expect %.c
|
||||||
@echo Test: $*...
|
@echo Test: $*...
|
||||||
|
|
Loading…
Reference in a new issue