From 25eaafd93cded893e641e25ecebe7e7166eb2ccb Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sun, 29 Jan 2017 06:18:26 +0330 Subject: added tdd tests for switchfixer and switchdfixer --- test/auto-refac-tdd/auto-refac-tdd01.c | 78 ++++++++++++++++++++++++++++++++++ test/auto-refac-tdd/auto-refac-tdd01.h | 6 ++- 2 files changed, 82 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/auto-refac-tdd/auto-refac-tdd01.c b/test/auto-refac-tdd/auto-refac-tdd01.c index 35e0b16..f4c156a 100644 --- a/test/auto-refac-tdd/auto-refac-tdd01.c +++ b/test/auto-refac-tdd/auto-refac-tdd01.c @@ -125,6 +125,84 @@ void tdd_iffixer(void) } +void tdd_switchfixer_switchdffixer(void) +{ + int level = 10U; + + switch (level) { + case 10U: { + level++; + level--; + break; + } + case 20U: { + level = 10000U; + break; + } + case 30U: { + level++; + break; + } + case 40U: { + level++; + break; + } + case 50U: { + level++; + break; + } + case 60U: { + level = 1000U; + break; + } + case 70U: { + level++; + break; + } + case 80U: { + level++; + break; + } + case 90U: { + level++; + break; + } + default: { + level++; + break; + } + } + + switch (level) { + case 1: { + level++; + break; + } + case 2: + level = 10; + level--; + { + case 3: + level = 10U; + level++; + break; + } + } + + switch (level) { + case 1: + level++; + case 2: + level = 1; + case 3: + level = 2; + default: + level++; + } + + switch (level) {} +} + void tdd_ifconstswapper(void) { int a; diff --git a/test/auto-refac-tdd/auto-refac-tdd01.h b/test/auto-refac-tdd/auto-refac-tdd01.h index 372fc3f..7586fe8 100644 --- a/test/auto-refac-tdd/auto-refac-tdd01.h +++ b/test/auto-refac-tdd/auto-refac-tdd01.h @@ -14,9 +14,11 @@ void tdd_forfixer(void); void tdd_whilefixer(void); -void ifelsefixer(void); +void tdd_ifelsefixer(void); -void iffixer(void); +void tdd_iffixer(void); + +void tdd_switchfixer_switchdffixer(void); void tdd_ifconstswapper(void); -- cgit v1.2.3