Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Implement a program that reads three integer numbers: a
, b
and
c
. The program must indicate whether the numbers can represent the
sides of a triangle. For this, each value must be less than the sum
of the other two. If so, the program must indicate if it is a:
scalene triangle (if all three sides are different),
equilateral triangle (if all three sides are equal), or
isosceles triangle (two equal sides and one different).
This triangle challenge is well known. It was proposed by Jerry Weinberg1, a famous computer scientist, and described by Glenford Myers, who wrote the first book on software testing, the classic The Art of Software Testing2.
Test your program with the set of test cases proposed below:
test case ID | inputs | expected output | ||
---|---|---|---|---|
a |
b |
c |
||
1 | 1 | 50 | 50 | Isosceles |
2 | 2 | 50 | 50 | Isosceles |
3 | 99 | 50 | 50 | Isosceles |
4 | 100 | 50 | 50 | Not a Traingle |
5 | 50 | 50 | 50 | Equilateral |
6 | 50 | 1 | 50 | Isosceles |
7 | 50 | 2 | 50 | Isosceles |
8 | 50 | 99 | 50 | Isosceles |
9 | 50 | 100 | 50 | Not a Triangle |
10 | 50 | 50 | 1 | Isosceles |
11 | 50 | 50 | 2 | Isosceles |
12 | 50 | 50 | 99 | Isosceles |
13 | 50 | 50 | 100 | Not a Triangle |
Insist that the students test their programs by giving them test
cases. Also include a bit of anecdotal history on the triangle
program and first book on software testing.