usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/stifassertmacros.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:54:11 +0300
branchRCL_3
changeset 22 5b2a402e96ac
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/


#ifndef STIFASSERT_MACRO_H
#define STIFASSERT_MACRO_H

#ifdef __STIF_ASSERT_SHARED
#undef __STIF_ASSERT_SHARED
/*********************************************************************************
 * Assert Macros
 *********************************************************************************/
#define __STIF_ASSERT_SHARED( aFunction, aMessage ) \
	if(!aFunction) \
		{ \
		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
		iResult.SetResult( KErrGeneral, _L("Testcase failed"));\
		return;\
		}
#endif

#ifdef __STIF_ASSERT_SHARED_DESC
#undef __STIF_ASSERT_SHARED_DESC
#define __STIF_ASSERT_SHARED_DESC( aFunction, aMessage, aDesc ) \
	if(!aFunction) \
		{ \
		iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\
		iResult.SetResult( KErrGeneral, aDesc );\
        return;\
		} \
	else \
		{ \
		iResult.SetResult( KErrNone, aDesc ); \
		}
#endif		

#ifdef STIF_ASSERT_PANIC_DESC
#undef STIF_ASSERT_PANIC_DESC

#define STIF_ASSERT_PANIC_DESC( aPanicCode, aStatement, aDescription ) \
	{ \
	TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \
	iResult.SetResult(KErrNone, aDescription); \
	aStatement; \
	}
#endif

#endif