use alert_cast instead of dynamic_cast in unit tests
This commit is contained in:
parent
5471b098eb
commit
a641f66258
|
@ -78,7 +78,7 @@ bool print_alerts(libtorrent::session& ses, char const* name
|
||||||
while (a.get())
|
while (a.get())
|
||||||
{
|
{
|
||||||
if (predicate && predicate(a.get())) ret = true;
|
if (predicate && predicate(a.get())) ret = true;
|
||||||
if (peer_disconnected_alert* p = dynamic_cast<peer_disconnected_alert*>(a.get()))
|
if (peer_disconnected_alert* p = alert_cast<peer_disconnected_alert>(a.get()))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s(%s): %s\n", name, print_endpoint(p->ip).c_str(), p->message().c_str());
|
fprintf(stderr, "%s(%s): %s\n", name, print_endpoint(p->ip).c_str(), p->message().c_str());
|
||||||
}
|
}
|
||||||
|
@ -88,9 +88,9 @@ bool print_alerts(libtorrent::session& ses, char const* name
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: %s\n", name, a->message().c_str());
|
fprintf(stderr, "%s: %s\n", name, a->message().c_str());
|
||||||
}
|
}
|
||||||
TEST_CHECK(dynamic_cast<fastresume_rejected_alert*>(a.get()) == 0 || allow_failed_fastresume);
|
TEST_CHECK(alert_cast<fastresume_rejected_alert>(a.get()) == 0 || allow_failed_fastresume);
|
||||||
|
|
||||||
TEST_CHECK(dynamic_cast<peer_error_alert*>(a.get()) == 0
|
TEST_CHECK(alert_cast<peer_error_alert>(a.get()) == 0
|
||||||
|| (!handles.empty() && h.is_seed())
|
|| (!handles.empty() && h.is_seed())
|
||||||
|| a->message() == "connecting to peer"
|
|| a->message() == "connecting to peer"
|
||||||
|| a->message() == "closing connection to ourself"
|
|| a->message() == "closing connection to ourself"
|
||||||
|
|
Loading…
Reference in New Issue