From: John Roth Date: 2001-12-08T23:57:08+09:00 Subject: [ruby-talk:27938] Re: A challenge to proponents of Unit Testing. "Robert C. Martin" wrote in message news:6nj21uo76gu2nfq92di0736dr4uags667k@4ax.com... > On 7 Dec 2001 02:04:08 -0800, stephen.hill@motorola.com (Steve Hill) > wrote: > > >What tests would you write for a function that takes 3 numbers (the > >side lengths of a triangle) , and returns whether the triangle is > >equilateral, scalene or isoceles. > > Set sides; // data structure allows no duplicates. > sides.add(a); > sides.add(b); > sides.add(c); > return sides; // 1 = equilateral, 2=isoceles, 3=scalene. > > What am I missing? Nice piece of code - a lot more elegant than my approach. I'm going to have to remember it. However, the question was about the unit tests, not about the implementation. It does bring up an interesting point (which I think someone else commented on, at least in passing.) This implementation really only requires three unit tests, not five, since it doesn't require that the three parameters be distinct. If this is the case, I'm at a loss to know what Kent's other two unit test cases were. John Roth