The Classic Triangle Testing Problem, (Myer’s Triangle): A program reads
three integer values. The three values are interpreted as representing the
lengths of the sides of a triangle. The program prints a message that states
whether the triangle is scalene, isosceles, or equilateral. Develop a set of
test cases (at least 6 ) that you feel will adequately test this program.
(This is a classic testing problem and you could find numerous explanations
about it on the internet. I would recommend that you try to submit your own
answer, based on your understanding of the topic)
Let’s define what the
three different types of triangle requirements for the side’s lengths are:
A scalene triangle is a
triangle with three sides having different lengths.
An isosceles triangle is
a triangle with two sides having equal lengths.
An equilateral triangle
is a triangle with all three sides of equal lengths.
The triangle inequality
Theorem states that the sum of 2 sides has to greater than the third side (Triangle inequality thereom rule explaned, nd).
The first test of course
is catching illegal input of a negative number being entered and the program
should catch that as not being allowed and rejected it requesting a positive
number informing the user that no negative numbers are allowed.
The second test case
scenario is catching the user entering non numbers and inform the user only
numbers are accepted as valid input and not symbols or alphabetical letters.
The third test case
scenario is catching that zero is not allowed as a value being entered and
informs the user to input a valid positive number that is bigger than zero.
The fourth case test
scenarios is checking that the 3 values entered that are valid indeed makes a
valid triangle by having the sum of two sides being greater than the third and
display an error message informing the user that the values entered don’t make
a valid triangle.
The fifth test case
scenario is when 3 valid but equal values are entered that it appropriately
display the message that it is an equilateral triangle.
The sixth test case
scenario is when 3 valid and different values are entered that it recognizes
that it is a scalene triangle and display the message accordingly.
The seventh test case
scenario is when 2 sides entered are of equal value that it informs the user
that it is indeed an isosceles triangle with 2 sides having equal length.
believe with these seven test cases, most user input errors are caught and
values are check to see if they make a valid triangle and then display what
type they are adequately giving us a program that will function as per
requested requirements given of the three triangle types.
Triangle inequality thereom rule explaned. (nd). Retrieved from Math Warehouse: