Back to schedule page
In-Class Exercise
TDD on Triangle

SWE 437, Spring 2018
26 February

This is an in-class group exercise. Work with some of your near neighbors. Print all names on the top of the page.

Consider the Triangle program, which has been used in interviews and in research papers for decades. Triangle has a very simple function:

Given three line-segment lengths S1, S2, and S3, what kind of triangle do they form?

Try Koskela’s TDD approach as he did in Chapter 2. Preliminary planning:

Now, let’s turn to adding functionality with TDD. Write a test for the triangle method.

  1. Implement enough code to make the test pass.
  2. Refactor as needed.
  3. Lather. Rinse. Repeat.