-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassifyTriangle.test.js
More file actions
136 lines (102 loc) · 4.77 KB
/
classifyTriangle.test.js
File metadata and controls
136 lines (102 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
const classifyTriangle = require('./classifyTriangle');
describe('classifyTriangle: Required input conditions - See readme for more details', () => {
// Equilateral triangle
test('should classify an Equilateral triangle', () => {
expect(classifyTriangle(10, 10, 10)).toBe('Equilateral');
});
test('should classify an Equilateral triangle', () => {
expect(classifyTriangle(77, 77, 77)).toBe('Equilateral');
});
// Isosceles triangle
test('should classify an Isosceles triangle', () => {
expect(classifyTriangle(10, 10, 5)).toBe('Isosceles');
});
// Scalene triangle
test('should classify a Scalene triangle', () => {
expect(classifyTriangle(10, 12, 14)).toBe('Scalene');
});
// Invalid inputs
test('should return error for invalid inputs', () => {
expect(classifyTriangle(0, 10, 10)).toBe('Error: Input conditions C1, C2, or C3 failed.');
});
test('should return error for invalid inputs', () => {
expect(classifyTriangle(0, 0, 95)).toBe('Error: Input conditions C1, C2, or C3 failed.');
});
// Not a triangle
test('should return "Not a Triangle" for invalid triangle sides', () => {
expect(classifyTriangle(1, 2, 3)).toBe('Not a Triangle');
});
// Additional test cases
test('should classify an Isosceles triangle with sides 5, 5, 3', () => {
expect(classifyTriangle(5, 5, 3)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 7, 9, 11', () => {
expect(classifyTriangle(7, 9, 11)).toBe('Scalene');
});
test('should classify an Equilateral triangle with sides 15, 15, 15', () => {
expect(classifyTriangle(15, 15, 15)).toBe('Equilateral');
});
test('should classify a Scalene triangle with sides 3, 4, 5', () => {
expect(classifyTriangle(3, 4, 5)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 8, 8, 6', () => {
expect(classifyTriangle(8, 8, 6)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 13, 14, 15', () => {
expect(classifyTriangle(13, 14, 15)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 10, 10, 7', () => {
expect(classifyTriangle(10, 10, 7)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 5, 12, 13', () => {
expect(classifyTriangle(5, 12, 13)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 9, 9, 4', () => {
expect(classifyTriangle(9, 9, 4)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 8, 15, 17', () => {
expect(classifyTriangle(8, 15, 17)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 12, 12, 9', () => {
expect(classifyTriangle(12, 12, 9)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 20, 21, 29', () => {
expect(classifyTriangle(20, 21, 29)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 14, 14, 11', () => {
expect(classifyTriangle(14, 14, 11)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 24, 25, 31', () => {
expect(classifyTriangle(24, 25, 31)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 16, 16, 13', () => {
expect(classifyTriangle(16, 16, 13)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 28, 45, 53', () => {
expect(classifyTriangle(28, 45, 53)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 18, 18, 15', () => {
expect(classifyTriangle(18, 18, 15)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 36, 39, 45', () => {
expect(classifyTriangle(36, 39, 45)).toBe('Scalene');
});
test('should classify an Isosceles triangle with sides 22, 22, 19', () => {
expect(classifyTriangle(22, 22, 19)).toBe('Isosceles');
});
test('should classify a Scalene triangle with sides 40, 48, 56', () => {
expect(classifyTriangle(40, 48, 56)).toBe('Scalene');
});
});
test('should classify a Scalene triangle', () => {
expect(classifyTriangle(10, 12, 14)).toBe('Scalene');
// add more test cases based on your requirements and Boundary Value Analysis + Equivalence Partitioning
});
test('should return error for invalid inputs', () => {
expect(classifyTriangle(0, 10, 10)).toBe('Error: Input conditions C1, C2, or C3 failed.');
// add more test cases based on your requirements and Boundary Value Analysis + Equivalence Partitioning
});
test('should return "Not a Triangle" for invalid triangle sides', () => {
expect(classifyTriangle(1, 2, 3)).toBe('Not a Triangle');
// add more test cases based on your requirements and Boundary Value Analysis + Equivalence Partitioning
});