use alert_cast instead of dynamic_cast in unit tests

This commit is contained in:
Arvid Norberg 2010-01-18 07:02:56 +00:00
parent 5471b098eb
commit a641f66258
1 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ bool print_alerts(libtorrent::session& ses, char const* name
while (a.get())
{
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());
}
@ -88,9 +88,9 @@ bool print_alerts(libtorrent::session& ses, char const* name
{
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())
|| a->message() == "connecting to peer"
|| a->message() == "closing connection to ourself"