Exhaustive testing example

Consider a program that implements the following requirement:

  • It is required to write a program that inputs two integers and outputs the maximum of these.

Suppose that this max program is to be tested on a computer in which integers range from -32,768 to 32,767. To test max on all possible integers would require it to be executed on all pairs of integers in this range. This will require a total of 2^32 executions of max. It will take approximately 4.2s to complete all executions assuming that testing is done on a computer that take 1 ns to input a pair of integers, execute max, and check if the output is correct.