Does the MUT call functions from other modules?
MUT: Module Under Test
void INInit(void); KWStatus INLoad(void);
foreach f in input/ run driver on f, saving output in act/f compare act/f with exp/f; report differences
input/test0: The C Programming Language The Cat in the Hat exp/test0: LSAddLine() LSAddWord(The) LSAddWord(C) LSAddWord(Programming) LSAddWord(Language) LSAddLine() LSAddWord(The) LSAddWord(Cat) LSAddWord(in) LSAddWord(the) LSAddWord(Hat)
void LSInit(void); KWStatus LSAddLine(void); KWStatus LSAddWord(char* word); const char* LSGetWord(int lineNum,int wordNum); int LSNumWords(int lineNum); int LSNumLines(void);
#define NUMLINES 5 #define MAWORDS 6 struct { int numWords; char* wordList[MAXWORDS]; } lineList[NUMLINES] = { {5,"The","Cat","in","the","Hat"}, {4,"The","C","Programming","Language"} ... };
Check that LSAddWord fails when there are no lines
Load all the lines in lineList, checking return codes
Check that LineList contains the lines in lineList
Check that line, word number range errors are detected
for (i = 0; i < NUMLINES; i++) { LSAddLine(); for (j = 0; j < lineList[i].numWords; j++) { LSAddWord(lineList[i].wordList[j]); } }