multimediacommscontroller/tsrc/Inc/mccunittestmacros.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __MCCUNITTESTMACROS_H__
       
    21 #define __MCCUNITTESTMACROS_H__
       
    22 
       
    23 #include <digia/eunit/eunitmacros.h>
       
    24 
       
    25 #define MCC_EUNIT_ASSERT_EQUALS( func, val ) \
       
    26 {\
       
    27 TInt mccUnitTestRetVal = func;\
       
    28 if ( mccUnitTestRetVal != KErrNoMemory ){\
       
    29 	EUNIT_ASSERT_EQUALS( mccUnitTestRetVal, val );\
       
    30 	}\
       
    31 else{\
       
    32 	User::Leave( KErrNoMemory );\
       
    33 	}\
       
    34 }
       
    35 
       
    36 #define MCC_EUNIT_ASSERT_SPECIFIC_LEAVE( func, val ) \
       
    37 {\
       
    38 TRAPD( mccUnitTestRetVal, func );\
       
    39 if ( val != KErrNoMemory && mccUnitTestRetVal == KErrNoMemory ){\
       
    40 	User::Leave( KErrNoMemory );\
       
    41 	}\
       
    42 else{\
       
    43 	EUNIT_ASSERT_EQUALS( mccUnitTestRetVal, val );\
       
    44 	}\
       
    45 }
       
    46 
       
    47 #define MCC_EUNIT_ASSERT_NO_LEAVE( func ) MCC_EUNIT_ASSERT_SPECIFIC_LEAVE( func, KErrNone )
       
    48 
       
    49 
       
    50 #endif