Commit 4a491eda by Alexander Wiebel

[FIX #413] eliminated warning in test

parent 1d1c6e53
Pipeline #250 passed with stages
in 37 minutes 27 seconds
......@@ -60,9 +60,9 @@ public:
/**
* Another helper class derived from WPrototyped. Used to check against \ref SomePrototypeClass1.
* Another helper class derived from \ref SomePrototypeClass1. Used to check against \ref SomePrototypeClass1.
*/
class SomePrototypeClass2: public WPrototyped
class SomePrototypeClass2: public SomePrototypeClass1
{
public:
/**
......@@ -87,6 +87,33 @@ public:
};
/**
* Another helper class derived from WPrototyped. Used to check against \ref SomePrototypeClass1.
*/
class SomePrototypeClass3: public WPrototyped
{
public:
/**
* Gets the name of this prototype.
*
* \return the name.
*/
virtual const std::string getName() const
{
return "test3";
};
/**
* Gets the description for this prototype.
*
* \return the description
*/
virtual const std::string getDescription() const
{
return "test3";
};
};
/**
* Test WPrototyped
*/
class WPrototypedTest : public CxxTest::TestSuite
......@@ -99,22 +126,30 @@ public:
{
SomePrototypeClass1 a;
SomePrototypeClass2 b;
SomePrototypeClass3 c;
// check the type checking mechanism in WPrototyped
// these should be true
TS_ASSERT( a.isA< WPrototyped >() );
TS_ASSERT( a.isA< SomePrototypeClass1 >() );
TS_ASSERT( b.isA< WPrototyped >() );
TS_ASSERT( b.isA< SomePrototypeClass2 >() );
TS_ASSERT( b.isA< SomePrototypeClass1 >() );
// The following lines would cause a warning
// "nonnull argument 'this' compared to NULL"
// because they would be always true,
// thus they are commented out.
//TS_ASSERT( a.isA< WPrototyped >() );
//TS_ASSERT( b.isA< WPrototyped >() );
//TS_ASSERT( c.isA< WPrototyped >() );
// check against other types not in polymorphic relation to each other (except the base class)
TS_ASSERT( !a.isA< SomePrototypeClass2 >() );
TS_ASSERT( !b.isA< SomePrototypeClass1 >() );
TS_ASSERT( !a.isA< SomePrototypeClass3 >() );
TS_ASSERT( !b.isA< SomePrototypeClass3 >() );
TS_ASSERT( !c.isA< SomePrototypeClass1 >() );
TS_ASSERT( !c.isA< SomePrototypeClass2 >() );
}
};
#endif // WPROTOTYPED_TEST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment