Thursday, November 1, 2012

Test type of triangle based on side lengths

Develop strategy and test type of triangle based on side lengths.

Strategy:
you're given sides a, b, and c.
let a <= b <= c.

for a = b = c, it's an equilateral tri.
for a = b < c or a < b = c, it's an isosceles tri.
for a < b < c, it's a scalene tri.

since we already said that a and b are the smallest 2 sides,
for a^2 + b^2 > c^2, it's an acute tri.
for a^2 + b^2 = c^2, it's a right tri.
for a^2 + b^2 < c^2, it's an obtuse tri.

equilateral triangle is always acute.
for a = b < c isosceles triangle, it IS an obtuse isosceles.
for a < b = c isosceles triangle, it IS an acute isosceles.

Also,

In an equilateral triangle, all three sides are the same length. An equilateral triangle is always equiangular.

In an isosceles triangle, two sides are the same length. An isosceles triangle may be right, obtuse, or acute.

In a scalene triangle, none of the sides are the same length. A scalene triangle may be right, obtuse, or acute.

In a right triangle, one of the angles is a right angle—an angle of 90 degrees. A right triangle may be isosceles or scalene.

In an obtuse triangle, one angle is greater than a right angle—it is more than 90 degrees. An obtuse triangle may be isosceles or scalene.

In an acute triangle, all angles are less than right angles—each one is less than 90 degrees. An acute triangle may be equilateral, isosceles, or scalene.

Writing Test Cases:
S.No.
Test case Name
Description
Expected Result
1
Check Scalene triangle
Enter input  as A=8, B=5 and C=7
Output should be scalene triangle
2
Check Scalene triangle
Enter input  as A=200, B=400 and C=900
Output should be scalene triangle
3
Check  isosceles triangle
Enter input  as A=8, B=10 and C=10
Output should be isosceles triangle
4
Check  isosceles triangle
Enter input  as A=800, B=700 and C=700
Output should be isosceles triangle
5
Check  equilateral triangle
Enter input  as A=15, B=15 and C=15
Output should be equilateral triangle
6
Check  equilateral triangle
Enter input  as A=190, B=190 and C=190
Output should be equilateral triangle
7
Check Negative values
Enter input  as A= -6, B=-15 and C=-14
Error message should be displayed
8
Check Negative values
Enter input  as A= 6, B=15 and C=-15
Error message should be displayed
9
Check Negative values
Enter input  as A= 6, B=-16 and C=-15
Error message should be displayed
10
Check Zero values
Enter input  as A= 6, B=16 and C=0
Error message should be displayed

No comments:

Post a Comment