From d23103dfc9105e0bd3c66bd446f8ecaa116675bd Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sat, 26 Nov 2016 07:18:58 +0330 Subject: added tdd tests for 14.6,14.7,14.8 --- test/main.c | 1 + test/testFuncs1.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testFuncs1.h | 1 + 3 files changed, 84 insertions(+) (limited to 'test') diff --git a/test/main.c b/test/main.c index 83798b5..1984e6e 100644 --- a/test/main.c +++ b/test/main.c @@ -75,5 +75,6 @@ main() test27(); test28(); test29(a); + test31(); } /*intentionally left blank.*/ diff --git a/test/testFuncs1.c b/test/testFuncs1.c index b70b3cd..4f606a2 100644 --- a/test/testFuncs1.c +++ b/test/testFuncs1.c @@ -1039,5 +1039,87 @@ loco: return a; } +void test30(void) +{ + int a; + int b; + int c; + + for (a = 0; a < 10; ++a) + { + a++; + + if (a == 5) + break; + if (a == 6) + break; + } + + for (a = 0; a < 10; a++) + { + a++; + if (a == 6) + break; + } + + while (a < 10) + { + if (b == 1) + break; + if (c == 1) + break; + } + + do { + if (a == 5) + break; + if (b == 6) + break; + if (c == 10) + break; + } while (a < 10); + + for (a = 0; a < 100; a++) + { + for (b = 0; b < 100; b++) + { + c++; + if (a == 1) + break; + } + for (c = 0; c < 100; c++) + { + b++; + if (a == 10) + break; + } + } + + for (a = 0; a < 100; a++) + { + if (a == 1) + break; + + while (a < 10) + { + b++; + if (c == 10) + break; + } + } +} + +int test31(void) +{ + int a; + + if (a == 1) + return 2; + else if (a == 2) + return 3; + else + return 1; +} + /**********************************************************************************************************************/ /*the last line's been intentionally left blank.*/ diff --git a/test/testFuncs1.h b/test/testFuncs1.h index 4d6827e..0915b12 100644 --- a/test/testFuncs1.h +++ b/test/testFuncs1.h @@ -125,6 +125,7 @@ void test26(void); void test27(void); void test28(void); int test29(int a); +int test31(void); /***********************************************************************************************************/ /*ive been intentionally left blank. dont touch me.*/ -- cgit v1.2.3