Fixed warnings in tests

This commit is contained in:
Antony Polukhin
2015-12-14 19:14:28 +03:00
parent 58e8e78899
commit b6e9403ef0
2 changed files with 3 additions and 6 deletions

View File

@@ -53,16 +53,13 @@ int main( int argc, char * argv[] )
// tests which should succeed
Derived derived_instance;
Base * base = &derived_instance;
Base2 * base2 = 0;
Derived * derived = 0;
derived = polymorphic_downcast<Derived*>( base ); // downcast
Derived * derived = polymorphic_downcast<Derived*>( base ); // downcast
assert( derived->kind() == 'D' );
derived = 0;
derived = polymorphic_cast<Derived*>( base ); // downcast, throw on error
assert( derived->kind() == 'D' );
base2 = polymorphic_cast<Base2*>( base ); // crosscast
Base2 * base2 = polymorphic_cast<Base2*>( base ); // crosscast
assert( base2->kind2() == '2' );
// tests which should result in errors being detected

View File

@@ -154,7 +154,7 @@ static void test_polymorphic_pointer_cast()
if( sp_base2 != 0 )
{
BOOST_TEST_EQ( base2->kind2(), "Base2" );
BOOST_TEST_EQ( sp_base2->kind2(), "Base2" );
}
}
catch( std::bad_cast const& )