Checklist
- Data Reference Errors
- Are all variables properly initialized?
(are all instance variables initialized in all constructors?)
- Do all pointers have a legal value? (i.e. NULL or pointing
to a valid location)
- Are pointers tested on being NULL where necessary?
- Alias problems? (e.g. several pointers pointing
to the same object)
- Are there any off-by-one errors?
(e.g. strings without terminating EOS byte)
- Could range bound errors occur? Eg: int array[max]; array[max]=0;
- Is garbage collection properly implemented? (e.g: are all dynamically
allocated objects (by new) eventually deallocated (by delete)?)
If not, does this represent an oversight?
- Are there any scope ambiguities? Do variable declarations hide other
declarations? If yes, is this an oversight? E.g:
class C {
public: C() { object* o = new object; }
private: object* o;
};
- (C++ experts only:) Do all base classes have a virtual destructor?
If not, does this represent an oversight?
- Computation Errors
- Are there errors in implicit type casts?
(E.g: mixed mode arithmetic (float/int conversion))
- Are underflow/overflow errors possible in math. computations?
- Is the precedence of operators always correct? (E.g: x = 3+4 / 5)
- Control-flow Errors
- Will every loop eventually terminate ?
- Will the program, module, procedure eventually terminate ?
- Are there any off-by-one errors? (one too many/few) iterations?
- Are there any non-exhaustive decisions (E.g: does every switch
statement cover all possible cases?)
If not, does this represent an oversight?
- Does every if statement have a corresponding else clause?
If not, does this represent an oversight?
- File I/O
- Are all files used correctly opened/closed?
- Does the program handle failures due to non-existing or
inaccessible files?
- C++ Tcl interface
- Are all options of new defined Tcl commands recognized
by properly processing all arguments?
- Does the program give a proper error message if incorrect arguments
are passed?
- Does the program return a result to the Tcl interpreter each
time a Tcl command is evoked?
Adapted from:
G.J Myers,
The Art of Software Testing,
Wiley & Sons, 1979
See also
Introduction
to debugging a C/C++ program.