@@ -8,13 +8,11 @@ int main(int argc, char* argv[]) {
8
8
assert (list.size () == 0 );
9
9
try {
10
10
list.pop_front ();
11
- std::cerr << " pop_front() throw an exception FAILED!" << std::endl;
12
11
} catch (const std::underflow_error &e){
13
12
std::cout << " pop_front() throw an exception PASSED: " << e.what () << std::endl;
14
13
}
15
14
try {
16
15
list.pop_back ();
17
- std::cerr << " pop_back() throw an exception FAILED!" << std::endl;
18
16
} catch (const std::underflow_error &e){
19
17
std::cout << " pop_back() throw an exception PASSED: " << e.what () << std::endl;
20
18
}
@@ -41,25 +39,21 @@ int main(int argc, char* argv[]) {
41
39
assert (list.get_at (2 ) == 22 );
42
40
try {
43
41
list.push_at (4 , 99 );
44
- std::cerr << " push_at() throw an exception FAILED!" << std::endl;
45
42
} catch (const std::out_of_range &e){
46
43
std::cout << " push_at() throw an exception PASSED: " << e.what () << std::endl;
47
44
}
48
45
try {
49
46
list.pop_at (3 );
50
- std::cerr << " pop_at() throw an exception FAILED!" << std::endl;
51
47
} catch (const std::out_of_range &e){
52
48
std::cout << " pop_at() throw an exception PASSED: " << e.what () << std::endl;
53
49
}
54
50
try {
55
51
list.change_at (3 , 99 );
56
- std::cerr << " change_at() throw an exception FAILED!" << std::endl;
57
52
} catch (const std::out_of_range &e){
58
53
std::cout << " change_at() throw an exception PASSED: " << e.what () << std::endl;
59
54
}
60
55
try {
61
56
list.get_at (3 );
62
- std::cerr << " get_at() throw an exception FAILED!" << std::endl;
63
57
} catch (const std::out_of_range &e){
64
58
std::cout << " get_at() throw an exception PASSED: " << e.what () << std::endl;
65
59
}
@@ -127,61 +121,51 @@ int main(int argc, char* argv[]) {
127
121
list.pop_at (0 ); // null
128
122
try {
129
123
list.push_at (1 , 99 );
130
- std::cerr << " push_at() throw an exception FAILED!" << std::endl;
131
124
} catch (const std::out_of_range &e){
132
125
std::cout << " push_at() throw an exception PASSED: )" << e.what () << std::endl;
133
126
}
134
127
try {
135
128
list.pop_at (1 );
136
- std::cerr << " pop_at() throw an exception FAILED!" << std::endl;
137
129
} catch (const std::out_of_range &e){
138
130
std::cout << " pop_at() throw an exception PASSED: )" << e.what () << std::endl;
139
131
}
140
132
try {
141
133
list.change_at (1 , 99 );
142
- std::cerr << " change_at() throw an exception FAILED!" << std::endl;
143
134
} catch (const std::out_of_range &e){
144
135
std::cout << " change_at() throw an exception PASSED: )" << e.what () << std::endl;
145
136
}
146
137
try {
147
138
list.pop_front ();
148
- std::cerr << " pop_front() throw an exception FAILED!" << std::endl;
149
139
} catch (const std::underflow_error &e){
150
140
std::cout << " pop_front() throw an exception PASSED: )" << e.what () << std::endl;
151
141
}
152
142
try {
153
143
list.pop_back ();
154
- std::cerr << " pop_back() throw an exception FAILED!" << std::endl;
155
144
} catch (const std::underflow_error &e){
156
145
std::cout << " pop_back() throw an exception PASSED: )" << e.what () << std::endl;
157
146
}
158
147
try {
159
148
list.change_eq_first (1 , 99 );
160
- std::cerr << " change_eq_first() throw an exception FAILED!" << std::endl;
161
149
} catch (const std::underflow_error &e){
162
150
std::cout << " change_eq_first() throw an exception PASSED: )" << e.what () << std::endl;
163
151
}
164
152
try {
165
153
list.change_eq_all (1 , 99 );
166
- std::cerr << " change_eq_all() throw an exception FAILED!" << std::endl;
167
154
} catch (const std::underflow_error &e){
168
155
std::cout << " change_eq_all() throw an exception PASSED: )" << e.what () << std::endl;
169
156
}
170
157
try {
171
158
list.front ();
172
- std::cerr << " front() throw an exception FAILED!" << std::endl;
173
159
} catch (const std::underflow_error &e){
174
160
std::cout << " front() throw an exception PASSED: )" << e.what () << std::endl;
175
161
}
176
162
try {
177
163
list.back ();
178
- std::cerr << " back() throw an exception FAILED!" << std::endl;
179
164
} catch (const std::underflow_error &e){
180
165
std::cout << " back() throw an exception PASSED: )" << e.what () << std::endl;
181
166
}
182
167
try {
183
168
list.contains (99 );
184
- std::cerr << " contains() throw an exception FAILED!" << std::endl;
185
169
} catch (const std::underflow_error &e){
186
170
std::cout << " contains() throw an exception PASSED: )" << e.what () << std::endl;
187
171
}
0 commit comments