// Tests
// Analysis

document.writeln("toDec('00'): " + toDec('00') + "<br>");
document.writeln("toDec('FF'): " + toDec('FF') + "<br>");
document.writeln("toDec('AA'): " + toDec('AA') + "<br>");
document.writeln("toDec('3A'): " + toDec('3A') + "<br>");
document.writeln("toDec('C0'): " + toDec('C0') + "<br>");
document.writeln("toDec('BD'): " + toDec('BD') + "<br>");

These lines test the toDec function. When testing a program, it is crucial to test the bounds of the function. In this case, the interesting values are 0 and 255. When testing a program or function, all special scenarios must be tested before you can be reasonably sure of the program or function's integrity.

After testing the boundary cases, a few random numbers were chosen. It is important that you verify these values as well by calculating thier values and then cross checking your results with those of the computer.

Close Window