Avoid warnings about unused test functions
Change-Id: I6b2a40c4b95555c4d8bf0d8674fce46accd49965
This commit is contained in:
@@ -89,14 +89,55 @@ private:
|
||||
oslInterlockedCount m_refCount;
|
||||
};
|
||||
|
||||
// Check that the up-casting Reference conversion constructor catches the
|
||||
// intended cases:
|
||||
|
||||
struct Base1: public css::uno::XInterface { virtual ~Base1() {} };
|
||||
struct Base2: public Base1 { virtual ~Base2() {} };
|
||||
struct Base3: public Base1 { virtual ~Base3() {} };
|
||||
struct Derived: public Base2, public Base3 { virtual ~Derived() {} };
|
||||
|
||||
// The special case using the conversion operator instead:
|
||||
css::uno::Reference< css::uno::XInterface > testUpcast1(
|
||||
css::uno::Reference< Derived > const & ref)
|
||||
{ return ref; }
|
||||
|
||||
// The normal up-cast case:
|
||||
css::uno::Reference< Base1 > testUpcast2(
|
||||
css::uno::Reference< Base2 > const & ref)
|
||||
{ return ref; }
|
||||
|
||||
// Commenting this in should cause a compiler error due to an ambiguous up-cast:
|
||||
/*
|
||||
css::uno::Reference< Base1 > testFailingUpcast3(
|
||||
css::uno::Reference< Derived > const & ref)
|
||||
{ return ref; }
|
||||
*/
|
||||
|
||||
// Commenting this in should cause a compiler error due to a down-cast:
|
||||
/*
|
||||
css::uno::Reference< Base2 > testFailingUpcast4(
|
||||
css::uno::Reference< Base1 > const & ref)
|
||||
{ return ref; }
|
||||
*/
|
||||
|
||||
// Commenting this in should cause a compiler error due to a down-cast:
|
||||
/*
|
||||
css::uno::Reference< Base1 > testFailingUpcast5(
|
||||
css::uno::Reference< css::uno::XInterface > const & ref)
|
||||
{ return ref; }
|
||||
*/
|
||||
|
||||
class Test: public ::CppUnit::TestFixture
|
||||
{
|
||||
|
||||
public:
|
||||
void testUnoSetThrow();
|
||||
void testUpcastCompilation();
|
||||
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
CPPUNIT_TEST(testUnoSetThrow);
|
||||
CPPUNIT_TEST(testUpcastCompilation);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
};
|
||||
|
||||
@@ -143,53 +184,18 @@ void Test::testUnoSetThrow()
|
||||
CPPUNIT_ASSERT_EQUAL( false, bCaughtException );
|
||||
}
|
||||
|
||||
// Include a dummy test calling those functions, to avoid warnings about those
|
||||
// functions being unused:
|
||||
void Test::testUpcastCompilation()
|
||||
{
|
||||
testUpcast1(css::uno::Reference< Derived >());
|
||||
testUpcast2(css::uno::Reference< Base2 >());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
} // namespace
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
// Check that the up-casting Reference conversion constructor catches the
|
||||
// intended cases:
|
||||
|
||||
namespace {
|
||||
|
||||
struct Base1: public css::uno::XInterface { virtual ~Base1() {} };
|
||||
struct Base2: public Base1 { virtual ~Base2() {} };
|
||||
struct Base3: public Base1 { virtual ~Base3() {} };
|
||||
struct Derived: public Base2, public Base3 { virtual ~Derived() {} };
|
||||
|
||||
}
|
||||
|
||||
// The special case using the conversion operator instead:
|
||||
css::uno::Reference< css::uno::XInterface > testUpcast1(
|
||||
css::uno::Reference< Derived > const & ref)
|
||||
{ return ref; }
|
||||
|
||||
// The normal up-cast case:
|
||||
css::uno::Reference< Base1 > testUpcast2(
|
||||
css::uno::Reference< Base2 > const & ref)
|
||||
{ return ref; }
|
||||
|
||||
// Commenting this in should cause a compiler error due to an ambiguous up-cast:
|
||||
/*
|
||||
css::uno::Reference< Base1 > testFailingUpcast3(
|
||||
css::uno::Reference< Derived > const & ref)
|
||||
{ return ref; }
|
||||
*/
|
||||
|
||||
// Commenting this in should cause a compiler error due to a down-cast:
|
||||
/*
|
||||
css::uno::Reference< Base2 > testFailingUpcast4(
|
||||
css::uno::Reference< Base1 > const & ref)
|
||||
{ return ref; }
|
||||
*/
|
||||
|
||||
// Commenting this in should cause a compiler error due to a down-cast:
|
||||
/*
|
||||
css::uno::Reference< Base1 > testFailingUpcast5(
|
||||
css::uno::Reference< css::uno::XInterface > const & ref)
|
||||
{ return ref; }
|
||||
*/
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user