os/ossrv/genericopenlibs/cppstdlib/test/runtime/src/dyn_cast_exe.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Name        : dyn_cast_exe.cpp
    15 // Part of     : standard c++ tests.
    16 // 
    17 //
    18 
    19 #include "dlla.h"
    20 #include "test_decls.h"
    21 #include <stdio.h>
    22 int main()
    23 {
    24 	printf("\n\nDynamic cast test...\n\n");
    25 	DynamicCastTest *aPtr = DynamicCastTest ::Instance();
    26 	printf("Ptr to object across dll boundary 0x%x\n",aPtr);
    27 	
    28 
    29 	if(dynamic_cast< DynamicCastTest_DerivedClass*>(aPtr)){
    30 		printf("dynamic_cast successful\n");
    31 		CPP_TESTS_ASSERT_ALLWAYS(1);
    32 		return 0;
    33 	}
    34 
    35 	CPP_TESTS_ASSERT_ALLWAYS(0);
    36 	return 1; // -> Even though the type of aPtr is DynamicCastTest*, dynamic_cast fails
    37 }