Lab: Head to Head Testing

Steven J. Zeil

Last modified: Jul 22, 2016
Contents:

There are many circumstances where you are working on a program but have access to a working (or nearly working) executable.

Whenever you find yourself working on a system for which you already have a (nearly) working executable, you can take advantage of this by doing head to head testing, in which you

Whatever the reason, it’s the differences in outputs that are particularly interesting. Spotting those differences can be quite tricky, however, if they are buried in a sea of nearly identical outputs or if the differences are “invisible” changes like adding blanks at the ends of lines or improperly indenting output.

Luckily, there are simple tools that you can use to find and highlight those differences.

1 Lab Instructions

  1. Read the problem description below.

Winmerge is quite a useful program. You can get your own copy at WinMerge. It is also available in a portable version that can be installed on a USB flashdrive and executed on almost any Windows machine).]

2 Problem Description: Triangle Diagnosis

This is a simple program that reads in three floating-point numbers at a time. These numbers represent the lengths of the three sides of a triangle. The program interprets these to classify the triangle and prints the name of the kind of triangle that it is. You may remember these terms from a geometry class long, long ago:

In addition, there are some less obvious cases:

The program reads from the standard input, three numbers at a time, until end of input is reached. For each trio of numbers, it prints a triangle classification to the standard output.