|
|
*
|
|
the most complicated function in the module is
stack_create, this function must dynamically allocate
the storage required for a stack, and check that the
allocation is successful, the other functions are quite
easy to write
Now that the implementation is complete, we need to
test the stack module
there are many types of tests that can be performed,
the one we will do is a simple functional test, the
basic idea is to show that all the functions operate
correctly under normal conditions
this type of test is used to show some confidence in
the correctness of the module, it is usually performed
after each modification to the module, and when its
transferred to another computer
in our test we will create a stack, perform a number
of operations on it, and then destroy the stack, a more
complete test would use multiple stacks to ensure that
there is no cross-talk between instances
after creating a stack, the new stack should be empty,
this gives us a chance to test the stack_empty and
stack_full procedures
next the stack is filled with integers, when this is
finished the stack should be full, so we can again test
stack_empty and stack_full
|
|