1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-26 20:01:35 +01:00

Add TCP and Utils::resolve_hwaddress active tests

[ci skip]
This commit is contained in:
Matias Fontanini
2016-03-22 19:49:26 -07:00
parent 068e304baa
commit 7bc1ab41f7
12 changed files with 366 additions and 24 deletions

View File

@@ -90,23 +90,9 @@ void ActiveTestRunner::do_run() {
auto packets = capturer_.captured_packets();
cout << prefix << "Captured " << packets.size() << " packets" << endl;
for (const auto& test : tests_) {
prefix = "[" + test->name() + "] ";
size_t i = 0;
while (i < packets.size() && !test->matches_packet(*packets[i])) {
++i;
}
if (i == packets.size()) {
cout << prefix << "ERROR: Packet was not captured" << endl;
}
else {
try {
test->validate_packet(*packets[i]);
cout << prefix << "OK" << endl;
}
catch (TestFailed& ex) {
cout << prefix << "ERROR: " << ex.what() << endl;
}
packets.erase(packets.begin() + i);
if (test->is_enabled()) {
test->validate(packets);
}
}
}