You can check out the “Triangle problem” program along with its tested test cases here.
In triangle problem, we require to identify output and input domain.
Output Domain:
O1 = Not a triangle, when any of the sides is greater than the sum of the other
O2 = Equilateral Triangle
O3 = Isosceles Triangle
O4 = Scalene Triangle
Input Domain:
I1 = { 0< a <= 10 }
I2 = { a<0 }
I3 = { a>10 }
I4 = { 0< b <= 10 }
I5= { b<0 }
I6 = { b>10 }
I7 = { 0< c <= 10 }
I8 = { c<0 }
I9 = { c>10 }
Further, on the basis of sides equality and whether the sum of the two sides are equal or greater, we can create classes.
I10 = { a=b=c }
I11 = { a=b, b!=c }
I12 = { b=c, c!=a }
I13 = { a=c, c!=b }
I14 = { a!=b!=c }
I15 = { a+b = c }
I16 = { a+b < c }
I17 = { b+c = a }
I18 = { b+c < a }
I19 = { c+a = b }
I20 = { c+a >b }
There are 4 possible outcomes and 20 possible input classes, in total 24 test cases to test.
Here are the test cases and program tested results.
Classes | a | b | c | Expected Output | Program Output | Tested Outcome |
---|---|---|---|---|---|---|
O1 | 10 | 5 | 5 | Not a Triangle | Not a Triangle | Pass |
O2 | 5 | 5 | 5 | Equilateral Triangle | Equilateral Triangle | Pass |
O3 | 1 | 5 | 5 | Isosceles Triangle | Isosceles Triangle | Pass |
O4 | 10 | 9 | 5 | Scalene Triangle | Scalene Triangle | Pass |
I1 | 5 | 5 | 5 | Equilateral Triangle | Equilateral Triangle | Pass |
I2 | 0 | 5 | 5 | Invalid Input | Invalid Input | Pass |
I3 | 11 | 5 | 5 | Invalid Input | Invalid Input | Pass |
I4 | 5 | 5 | 5 | Equilateral Triangle | Equilateral Triangle | Pass |
I5 | 5 | 0 | 5 | Invalid Input | Invalid Input | Pass |
I6 | 5 | 11 | 5 | Invalid Input | Invalid Input | Pass |
I7 | 5 | 5 | 5 | Equilateral Triangle | Equilateral Triangle | Pass |
I8 | 5 | 5 | 0 | Invalid Input | Invalid Input | Pass |
I9 | 5 | 5 | 11 | Invalid Input . | Invalid Input | Pass |
I10 | 5 | 5 | 5 | Equilateral Triangle | Equilateral Triangle | Pass |
I11 | 5 | 5 | 1 | Isosceles Triangle | Isosceles Triangle | Pass |
I12 | 1 | 5 | 5 | Isosceles Triangle | Isosceles Triangle | Pass |
I13 | 5 | 1 | 5 | Isosceles Triangle | Isosceles Triangle | Pass |
I14 | 9 | 5 | 10 | Scalene Triangle | Scalene Triangle | Pass |
I15 | 5 | 5 | 10 | Not a Triangle | Not a Triangle | Pass |
I16 | 1 | 5 | 10 | Not a Triangle | Not a Triangle | Pass |
I17 | 10 | 5 | 5 | Not a Triangle | Not a Triangle | Pass |
I18 | 10 | 5 | 1 | Not a Triangle | Not a Triangle | Pass |
I19 | 5 | 10 | 5 | Not a Triangle | Not a Triangle | Pass |
I20 | 5 | 10 | 1 | Not a Triangle | Not a Triangle | Pass |