Joe Strazzere - All Things Quality

Visit my new blog at http://strazzere.blogspot.com/


April 4, 2006 - Triangle Analyzer Program

Posted in QA

"The Complete Guide to Software Testing" by Bill Hetzel is another classic of software testing.  He gives a slightly different twist on the famous "Triangle Test", with his "Triangle Analyzer":

 

Triangle Analyzer Example Program Specifications

 

Input

Three numbers separated by commas or spaces

Processing

Determine if three numbers make a valid triangle; if not, print message NOT A TRIANGLE.

 

If it is a triangle, classify it according to the length of the sides as scalene (no sides equal), isoscelese (two sides equal), or equilateral (all sides equal).

 

If it is a triangle, classify it according to the largest angle as acute (less than 90 degrees), obtuse (greater than 90 degrees), or right (exactly 90 degrees).

Output

One line listing the three numbers provided as input and the classification or the not a triangle message.

 

Examples:

3,4,5 - Scalene - Right

6,1,6 - Isoscelese - Acute

5,1,2 - Not a triangle


Triangle Analyzer Program - Selection of Functional Cases

 

Scalene

  • Acute - 6.5.3
  • Obtuse - 5.6.10
  • Right - 3.4.5

Isosceles

  • Acute - 6,1,6
  • Obtuse - 7,4,4
  • Right - 1,1, Sqrt(2) 

Equilateral

  • Acute - 4,4,4
  • Obtuse - not possible
  • Right - not possible

Functional Cases

  • 1,2,8 - Not a triangle
  • 6,5,3 - Scalene Acute
  • 5,6,10 - Scalene Obtuse
  • 3,4,5 - Scalene Right
  • 6,1,6 - Isosceles Acute
  • 7,4,4 - Isosceles Obtuse
  • 1,1,Sqrt(2) - Isosceles Right
  • 4,4,4 - Equilateral Acute

Extreme cases

  • 1,1,2 - Not a triangle (Makes a straight line, not a triangle)
  • 0,0,0 - Not a triangle (Makes a point, not a triangle)
  • 4,0,3 - Not a triangle (A zero side)
  • 1,2,3.00001 - Not a triangle (Close to a triangle)
  • 9170,9168,3 - Scalene Acute (Very small angle)
  • 0.001, 0.0001, 0.001 - Equilateral Acute (Very small triangle)
  • 83127168, 74326166, 96652988 - Scalene Obtuse (Very large triangle)
  • 3.0000001,3,3 - Isosceles Acute (Very close to equilateral)
  • 2.999999,4,5 - Scalene Acute (Very close to isosceles)
  • 3,4,5.000000001 - Scalene Obtuse (Near right triangle)
  • 1.1.1.41414141414141414 - Isosceles Acute (Near right triangle)
  • 3,4,5,6 - Not a triangle (Four sides)
  • 646 - Not a triangle (Three-digit single number)
  • 3,,4,5 - Not a triangle (Two commas)
  • 3 4,5 - Not a triangle (Missing comma)
  • 3.14.6,4,5 - Not a triangle (Two decimal points)
  • 4,6 - Not a triangle (Two sides)
  • 5,5,A - Not a triangle (Character as a side)
  • 6, -4, 6 - Not a triangle (Negative number as a side)
  • -3, -3, -3 - Not a triangle (All negative numbers)
  •           - Not a triangle (Empty input)

<- Last Page :: Next Page ->

About Me

A gathering place for information and ideas about Quality Assurance, Testing, and other useful topics.

Problems cannot be solved by the same level of thinking that created them. - A. Einstein

Search This Site

Translate This Site

RSS Feed

Subscribe

Twitter

@jstrazzere

Categories

Life
QA
Sports
Tools
WinTask
Work in General

What I'm Reading Now