< previous page page_890 next page >

Page 890
class TimeType
{
public:
    void Set( /* in */ int hours,
              /* in */ int minutes,
              /* in */ int seconds );
        // Precondition:  
        // Postcondition:  

    void Increment();
        // Postcondition:  

    void Write() const;
        // Postcondition:  

    Boolean Equal( /* in */ TimeType otherTime ) const;
        // Postcondition:  

    Boolean LessThan( /* in */ TimeType otherTime ) const;
        // Precondition:  
        // Postcondition:  

    TimeType( /* in */ int initHrs,
              /* in */ int initMins,
              /* in */ int initSecs );
        // Precondition:  
        // Postcondition:  

    TimeType();
        // Postcondition:  
private:
    int hrs;
    int mins;
    int secs;
};
To test this class fully, we must test each of the member functions. Let's step through the process of testing just one of them: the Increment function.
When we implemented the Increment function, we presumably started with a pseudocode algorithm, performed an algorithm walk-through, and translated the pseudocode into the following C++ function:
void TimeType::Increment()

// Postcondition:
//     Time has been advanced by one second, with
//     23:59:59 wrapping around to 0:0:0

{

 
< previous page page_890 next page >