// tests for min function
// Analysis

document.writeln("minDif(0, 0, 0): " + minDif(0, 0, 0) + "<br>");
document.writeln("minDif(20, 0, 0): " + minDif(20, 0, 0) + "<br>");
document.writeln("minDif(0, 20, 0): " + minDif(0, 20, 0) + "<br>");
document.writeln("minDif(0, 0, 20): " + minDif(0, 0, 20) + "<br>");
document.writeln("minDif(20, 20, 0): " + minDif(20, 20, 0) + "<br>");
document.writeln("minDif(0, 20, 20): " + minDif(0, 20, 20) + "<br>");
document.writeln("minDif(20, 0, 20): " + minDif(20, 0, 20) + "<br>");
document.writeln("minDif(10, 0, 20): " + minDif(10, 0, 20) + "<br>");
document.writeln("minDif(20, 0, 10): " + minDif(20, 0, 10) + "<br>");
document.writeln("minDif(0, 10, 20): " + minDif(0, 10, 20) + "<br>");
document.writeln("minDif(0, 20, 10): " + minDif(0, 20, 10) + "<br>");
document.writeln("minDif(10, 20, 0): " + minDif(10, 20, 0) + "<br>");
document.writeln("minDif(20, 10, 0): " + minDif(20, 10, 0) + "<br>");
document.writeln("minDif(20, 10, 10): " + minDif(20, 10, 10) + "<br>");
document.writeln("minDif(10, 20, 10): " + minDif(10, 20, 10) + "<br>");
document.writeln("minDif(10, 10, 20): " + minDif(10, 10, 20) + "<br>");
document.writeln("minDif(10, 20, 30): " + minDif(10, 20, 30) + "<br>");
document.writeln("minDif(10, 30, 20): " + minDif(10, 30, 20) + "<br>");
document.writeln("minDif(20, 10, 30): " + minDif(20, 10, 30) + "<br>");
document.writeln("minDif(30, 10, 20): " + minDif(30, 10, 20) + "<br>");
document.writeln("minDif(20, 10, 30): " + minDif(20, 10, 30) + "<br>");
document.writeln("minDif(20, 30, 10): " + minDif(20, 30, 10) + "<br>");
document.writeln("minDif(30, 20, 10): " + minDif(30, 20, 10) + "<br>");
document.writeln("minDif(20, 20, 20): " + minDif(20, 20, 20) + "<br>");

This function, more so than the others, requires vigorous testing. The series of writeln() statements print the function with the test values to the screen, and then prints the return values.

The series of statements tests every possible case of interest. It is crucial for the remaining code that the minDif function handles 0's appropriately, so those situations are tested thoroughly as well.

Close Window