May 2002
Beginner
320 pages
6h 18m
English
Tests fall into several categories as well:
Empty tests determine whether a class, program, or system works correctly the first time it is run, or when it has no data. For instance, testing the most recent implementation of the calculator with an empty tape file shows that you need the following in aPersistentTapeExternalInterface:
1: char OperatorChar;
2: myTapeSourceInputStream >> OperatorChar;
3:
*4: if (OperatorChar == '\0')
5: {
6: myTapeSourceInputStream.close();
7: return anExternalInterface:: GetOperatorChar();
8: }
9: else
10: {
11: return OperatorChar;
12: };
An empty test reveals the need for Line 4; the empty file returns a char '\0', and when this character passes into the system it causes a bad ...
Read now
Unlock full access