olczyk / interaccess.com (Thaddeus L Olczyk) wrote in message news:<3c1a2e6d.18210812 / nntp.interaccess.com>...
> On 11 Dec 2001 07:35:20 -0800, rbinder / rbsc.com (Bob Binder) wrote:
> 
> >Robert C. Martin <rmartin @ objectmentor . com> wrote in message news:<d62b1ukh61hal31708f4afr99ppg3utkde / 4ax.com>...
> >> On 10 Dec 2001 09:35:08 -0800, rbinder / rbsc.com (Bob Binder) wrote:
> >> 
> >> >Robert C. Martin <rmartin @ objectmentor . com> wrote in message news:<h2n41ucnnc8ipnseets4eess8rbqehkes6 / 4ax.com>...
> >> >> On Sat, 08 Dec 2001 00:35:43 -0600, Robert C. Martin <rmartin @
> >> >> objectmentor . com> wrote:
> >> >> 
> >> >> >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<int> sides; // data structure allows no duplicates.
> >> >> >sides.add(a);
> >> >> >sides.add(b);
> >> >> >sides.add(c);
> >> >> >return sides.length(); // 1 = equilateral, 2=isoceles, 3=scalene.
>       ^^^^^^^^^--oops.
> >> >> >
> >> >> >What am I missing?
> >> >
> >> >In this example, wouldn't using an int set for the sides prevent
> >> >representing any triangle with two or more equal lengths -- I think a
> >> >bag would do the job. Assuming that your set would reject identical
> >> >values, any test suite which did not include tests like 3,3,4 or 3,3,3
> >> >would miss that bug.
> >> 
> >> The intent was to return a 1 for equilateral, 2 for isoceles, and 3
> >> for scalene.  Representing the triangle was not part of the job.
> >> 
> >
> >Ok, this is clever way to do the classification. But it seems to me
> >this is only a fragment of the solution to the scope of the complete
> >triangle problem, and conclusions drawn about testing this fragment
> >versus testing a complete solution are skewed.
> >
> >Unless Set objects silently reject dups, the client code will have to
> >have a catch block, which means part of the classification scheme
> >resides in the client. The client will have to constrain lengths to 1
> >or greater, and assure that the sides are constructable for the
> >isoceles and scalene cases. If not, your code will claim that 1,1,10
> >and 1,2,10 are sides of triangle, which they are not. As the
> >implementation of these constraints is necessary for producing correct
> >answers, it should be included in scope of the test suite.
> >
> You must also add a reporting mechanism for the violation of these
> tests. And then you need to add more tests for the reporting
> mechanism.

This whole discussion, and the effectiveness and coverage of the
testing performed by the XP method, hinges, like other test moethods,
on the quality and correctness of the requirements, both functional
and in programming flexibity. I have not read anything on the XP web
pages concerning this area. Do you have formal methods in this area?