Algorithm Testing
Computer systems need to be reliable. To make sure of this, testing is undertaken at many different stages of software development.

Algorithms can be tested by checking the outputs for selected input data values, to make sure they are as expected.

 

Selection of Test Data

When testing an algorithm, you need to run a sequence of tests. If one test works, that does not mean the program will work every time!

Select...

  • data which is 'normal'
  • data which is extreme
  • data which is incompatible ie data of the wrong type
  • data which is non-existent ie zero or null data

Example

If you are testing a procedure which calculates the VAT on the price of a purchased item, choose

  • sensible prices eg £12.50
  • very large or very small prices eg £0.01 or £12,000,000,000,000,000.00
  • try giving it a string! eg 'Hello'
  • try £0.00 or even a null input.