natplugins/natpnatfwsdpprovider/tsrc/testconsole/inc/nsptestconsolemacros.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2008 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:  NAT FW SDP Provider test console macros, asserts & logs
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NSPTESTCONSOLEMACROS_H
       
    19 #define NSPTESTCONSOLEMACROS_H
       
    20 
       
    21 #define COMPONENT
       
    22 _LIT( KComponent, "NSP test console" );
       
    23 
       
    24 #include "nspdefs.h"
       
    25 
       
    26 const TInt KAssertFailure = -20100;
       
    27 
       
    28 struct Result
       
    29 	{
       
    30 	enum TState{ ECreated = 0, ERunning, EPass, EFail } iState;
       
    31 	TBuf<255> iDescription;
       
    32 	};
       
    33 
       
    34 typedef struct Result TResult;
       
    35 
       
    36 #define __ASSERT( aStatement ) \
       
    37 	__ASSERT_ALWAYS( aStatement, User::Leave( KAssertFailure ) )
       
    38 
       
    39 #define START( aSetupStatus, aCons, aDesc ) \
       
    40 	if ( KErrNone != aSetupStatus )\
       
    41 		{\
       
    42 		NSPLOG_STR( "******************************************" );\
       
    43 		NSPLOG_STR2( "FAILURE in SetupL, test:", aDesc );\
       
    44 		NSPLOG_INT(  "with               code:", aSetupStatus );\
       
    45 		aCons.Printf( _L( "%S - FAILURE in SetupL\n\n" ), &aDesc );\
       
    46 		NSPLOG_STR( "******************************************" );\
       
    47 		}\
       
    48 	else\
       
    49 		{\
       
    50 		NSPLOG_STR( "******************************************" );\
       
    51 		NSPLOG_STR2( "STARTING test:", aDesc );\
       
    52 		aCons.Printf( _L( "%S - STARTING\n\n" ), &aDesc );\
       
    53 		NSPLOG_STR( "******************************************" );\
       
    54 		}
       
    55 
       
    56 #define END( aCons, aDesc, aState ) \
       
    57 	NSPLOG_STR( "******************************************" );\
       
    58 	NSPLOG_STR2( "ENDED    test:", aDesc );\
       
    59 	NSPLOG_INT(  "with     code:", aState );\
       
    60 	aCons.Printf( _L( "\n%S - ENDED with %d\n\n" ), &aDesc, aState );\
       
    61 	NSPLOG_STR( "******************************************" )
       
    62 
       
    63 #define WAIT( aCons, aText ) aCons.Printf( _L( "Waiting " aText "..\n" ) )
       
    64 
       
    65 #define COMPLETED_L( aCons, aText, aTimerStatus ) \
       
    66 	if ( KErrTimedOut == aTimerStatus )\
       
    67 		{ aCons.Printf( _L("..Timeout " aText "\n" ) ); User::Leave( KErrTimedOut ); }\
       
    68 	else if ( KErrCancel == aTimerStatus )\
       
    69 		{ aCons.Printf( _L("..Canceled " aText "\n" ) ); User::Leave( KErrCancel ); }\
       
    70 	else{ aCons.Printf( _L("..Completed " aText "\n" ) ); }
       
    71 
       
    72 
       
    73 #endif // NSPTESTCONSOLEMACROS_H