Commit 6de2d930 authored by Ralf Habacker's avatar Ralf Habacker

Add dynamic cast test to be sure we can trust getting zero pointer for invalid casts.

CCBUG:341709
parent c359c267
......@@ -26,6 +26,7 @@ class TEST_basictypes : public QObject
{
Q_OBJECT
private slots:
void test_dynamic_cast();
void test_ModelType_toString();
void test_ModelType_fromString();
void test_ModelType_forLoop();
......@@ -48,6 +49,26 @@ private slots:
//-----------------------------------------------------------------------------
class A
{
public:
virtual ~A () { }
};
class B : public A
{
};
void TEST_basictypes::test_dynamic_cast()
{
A *a1 = new A;
B* b1 = dynamic_cast<B*> (a1);
QVERIFY(!b1);
A *a2 = new B;
B* b2 = dynamic_cast<B*> (a2);
QVERIFY(b2);
}
void TEST_basictypes::test_ModelType_toString()
{
Uml::ModelType::Enum model0 = Uml::ModelType::Logical;
......
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