Skip to content

Commit 2112b12

Browse files
committed
fix test of LinkedList again
1 parent 1177f3f commit 2112b12

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

data-structures/LinkedList/__test__/test_LinkedList.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ int main(int argc, char* argv[]) {
88
assert(list.size() == 0);
99
try{
1010
list.pop_front();
11-
std::cerr << "pop_front() throw an exception FAILED!" << std::endl;
1211
} catch(const std::underflow_error &e){
1312
std::cout << "pop_front() throw an exception PASSED: " << e.what() << std::endl;
1413
}
1514
try{
1615
list.pop_back();
17-
std::cerr << "pop_back() throw an exception FAILED!" << std::endl;
1816
} catch(const std::underflow_error &e){
1917
std::cout << "pop_back() throw an exception PASSED: " << e.what() << std::endl;
2018
}
@@ -41,25 +39,21 @@ int main(int argc, char* argv[]) {
4139
assert(list.get_at(2) == 22);
4240
try{
4341
list.push_at(4, 99);
44-
std::cerr << "push_at() throw an exception FAILED!" << std::endl;
4542
} catch(const std::out_of_range &e){
4643
std::cout << "push_at() throw an exception PASSED: " << e.what() << std::endl;
4744
}
4845
try{
4946
list.pop_at(3);
50-
std::cerr << "pop_at() throw an exception FAILED!" << std::endl;
5147
} catch(const std::out_of_range &e){
5248
std::cout << "pop_at() throw an exception PASSED: " << e.what() << std::endl;
5349
}
5450
try{
5551
list.change_at(3, 99);
56-
std::cerr << "change_at() throw an exception FAILED!" << std::endl;
5752
} catch(const std::out_of_range &e){
5853
std::cout << "change_at() throw an exception PASSED: " << e.what() << std::endl;
5954
}
6055
try{
6156
list.get_at(3);
62-
std::cerr << "get_at() throw an exception FAILED!" << std::endl;
6357
} catch(const std::out_of_range &e){
6458
std::cout << "get_at() throw an exception PASSED: " << e.what() << std::endl;
6559
}
@@ -127,61 +121,51 @@ int main(int argc, char* argv[]) {
127121
list.pop_at(0); // null
128122
try{
129123
list.push_at(1, 99);
130-
std::cerr << "push_at() throw an exception FAILED!" << std::endl;
131124
} catch(const std::out_of_range &e){
132125
std::cout << "push_at() throw an exception PASSED: )" << e.what() << std::endl;
133126
}
134127
try{
135128
list.pop_at(1);
136-
std::cerr << "pop_at() throw an exception FAILED!" << std::endl;
137129
} catch(const std::out_of_range &e){
138130
std::cout << "pop_at() throw an exception PASSED: )" << e.what() << std::endl;
139131
}
140132
try{
141133
list.change_at(1, 99);
142-
std::cerr << "change_at() throw an exception FAILED!" << std::endl;
143134
} catch(const std::out_of_range &e){
144135
std::cout << "change_at() throw an exception PASSED: )" << e.what() << std::endl;
145136
}
146137
try{
147138
list.pop_front();
148-
std::cerr << "pop_front() throw an exception FAILED!" << std::endl;
149139
} catch(const std::underflow_error &e){
150140
std::cout << "pop_front() throw an exception PASSED: )" << e.what() << std::endl;
151141
}
152142
try{
153143
list.pop_back();
154-
std::cerr << "pop_back() throw an exception FAILED!" << std::endl;
155144
} catch(const std::underflow_error &e){
156145
std::cout << "pop_back() throw an exception PASSED: )" << e.what() << std::endl;
157146
}
158147
try{
159148
list.change_eq_first(1, 99);
160-
std::cerr << "change_eq_first() throw an exception FAILED!" << std::endl;
161149
} catch(const std::underflow_error &e){
162150
std::cout << "change_eq_first() throw an exception PASSED: )" << e.what() << std::endl;
163151
}
164152
try{
165153
list.change_eq_all(1, 99);
166-
std::cerr << "change_eq_all() throw an exception FAILED!" << std::endl;
167154
} catch(const std::underflow_error &e){
168155
std::cout << "change_eq_all() throw an exception PASSED: )" << e.what() << std::endl;
169156
}
170157
try{
171158
list.front();
172-
std::cerr << "front() throw an exception FAILED!" << std::endl;
173159
} catch(const std::underflow_error &e){
174160
std::cout << "front() throw an exception PASSED: )" << e.what() << std::endl;
175161
}
176162
try{
177163
list.back();
178-
std::cerr << "back() throw an exception FAILED!" << std::endl;
179164
} catch(const std::underflow_error &e){
180165
std::cout << "back() throw an exception PASSED: )" << e.what() << std::endl;
181166
}
182167
try{
183168
list.contains(99);
184-
std::cerr << "contains() throw an exception FAILED!" << std::endl;
185169
} catch(const std::underflow_error &e){
186170
std::cout << "contains() throw an exception PASSED: )" << e.what() << std::endl;
187171
}

0 commit comments

Comments
 (0)