telephonyserverplugins/common_tsy/test/integration/inc/comparisonfunctions.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 #ifndef COMPARISONFUNCTIONS_H
       
    17 #define COMPARISONFUNCTIONS_H
       
    18 
       
    19 #include <e32def.h>
       
    20 #include <e32const.h>
       
    21 #include <stddef.h>
       
    22 #include <string.h>
       
    23 #include <etel.h>
       
    24 #include <etelpckt.h>
       
    25 #include <etelmm.h>
       
    26 #include "cctsyintegrationtestsuitebase.h"
       
    27 
       
    28 enum TLogError
       
    29 	{
       
    30 	ELogError,
       
    31 	ENoLogError
       
    32 	};
       
    33 
       
    34 	
       
    35 template<class Type>
       
    36 class TCmpBase
       
    37 	{
       
    38 public:
       
    39 	inline TCmpBase(Type& aExpected, Type& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
    40 	Type& GetExpected() { return iExpected; }
       
    41 	Type& GetValue() { return iValue; }	
       
    42 	inline CTestExecuteLogger& Logger() {return iTestStep.Logger(); };
       
    43 		
       
    44 	virtual TBool IsEqual(TLogError /*aLogError*/) { return (memcmp(&iExpected, &iValue, sizeof(iExpected))==0); }
       
    45 
       
    46 protected:
       
    47 	Type& iExpected;
       
    48 	Type& iValue;
       
    49 	CCTSYIntegrationTestSuiteStepBase& iTestStep;
       
    50 	}; // class TCmpBase
       
    51 
       
    52 
       
    53 template<class Type>
       
    54 class TCapsCmpBase
       
    55 	{
       
    56 public:
       
    57 	inline TCapsCmpBase(Type& aWantedCaps, Type& aUnwantedCaps, Type& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
    58 	Type& GetWantedCaps() { return iUnwantedCaps; }
       
    59 	Type& GetUnwantedCaps() { return iWantedCaps; }
       
    60 	Type& GetValue() { return iValue; }
       
    61 	inline CTestExecuteLogger& Logger() {return iTestStep.Logger(); };
       
    62 	
       
    63 	virtual TBool IsEqual(TLogError aLogError);
       
    64 
       
    65 protected:
       
    66 	Type& iWantedCaps;
       
    67 	Type& iUnwantedCaps;
       
    68 	Type& iValue;
       
    69 	CCTSYIntegrationTestSuiteStepBase& iTestStep;
       
    70 	}; // class TCapsCmpBase	
       
    71 
       
    72 
       
    73 class TCmpRCallTCallInfo : public TCmpBase<RCall::TCallInfo>
       
    74 	{
       
    75 public:
       
    76 	TCmpRCallTCallInfo(RCall::TCallInfo& aExpected, RCall::TCallInfo& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
    77 	
       
    78 	virtual TBool IsEqual(TLogError aLogError);
       
    79 	}; // class TCmpRCallTCallInfo
       
    80 
       
    81 
       
    82 class TCmpRCallTCallInfoNoHookValidName : public TCmpBase<RCall::TCallInfo>
       
    83 	{
       
    84 public:	
       
    85 	TCmpRCallTCallInfoNoHookValidName(RCall::TCallInfo& aExpected, RCall::TCallInfo& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
    86 	
       
    87 	virtual TBool IsEqual(TLogError aLogError);
       
    88 	}; // class TCmpRCallTCallInfoNoHookValidName
       
    89 
       
    90 
       
    91 class TCmpRMobileCallTMobileCallCaps : public TCmpBase<RMobileCall::TMobileCallCapsV1>
       
    92 	{
       
    93 	public:
       
    94     TCmpRMobileCallTMobileCallCaps(RMobileCall::TMobileCallCapsV1& aExpected, RMobileCall::TMobileCallCapsV1& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
    95 	
       
    96     virtual TBool IsEqual(TLogError aLogError);
       
    97 	}; // class TCmpRMobileCallTMobileCallCaps
       
    98 
       
    99 
       
   100 class TCmpRMobileCallTMobileCallRemotePartyInfo : public TCmpBase<RMobileCall:: TMobileCallRemotePartyInfoV1>
       
   101 	{
       
   102 	public:
       
   103 	TCmpRMobileCallTMobileCallRemotePartyInfo(RMobileCall::TMobileCallRemotePartyInfoV1& aExpected, RMobileCall::TMobileCallRemotePartyInfoV1& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
   104 	
       
   105 	virtual TBool IsEqual(TLogError aLogError);
       
   106 	}; // class TCmpRMobileCallTMobileCallRemotePartyInfo
       
   107 
       
   108 
       
   109 template<class Type>
       
   110 inline TCmpBase<Type>::TCmpBase(Type& aExpected, Type& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep) 
       
   111 	: iExpected(aExpected), iValue(aValue), iTestStep(aTestStep)
       
   112 	{
       
   113 	}
       
   114 
       
   115 
       
   116 template<class Type>
       
   117 inline TCapsCmpBase<Type>::TCapsCmpBase(Type& aWantedCaps, Type& aUnwantedCaps, Type& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
   118 	: iWantedCaps(aWantedCaps), iUnwantedCaps(aUnwantedCaps), iValue(aValue), iTestStep(aTestStep)
       
   119 	{
       
   120 	}
       
   121 
       
   122 
       
   123 template<class Type>
       
   124 TBool TCapsCmpBase<Type>::IsEqual(TLogError aLogError)
       
   125 	{
       
   126 	if (((iValue & iWantedCaps) != iWantedCaps) || 
       
   127 		((iValue & iUnwantedCaps) != 0))
       
   128 			{
       
   129 			if(aLogError == ELogError)
       
   130 				{
       
   131 				_LIT(KAssertBitsSet, "FAILURE: Wrong bits set : Got 0x%x , required 0x%x, unwanted 0x%x");
       
   132 				ERR_PRINTF4(KAssertBitsSet, iValue, iWantedCaps, iUnwantedCaps);
       
   133 				}
       
   134 			return EFalse;
       
   135 			}
       
   136 		else
       
   137 			{
       
   138 			return ETrue;
       
   139 			}
       
   140 	}
       
   141 
       
   142 
       
   143 class TCmpTMobilePhoneLockInfoV1NoStatus : public TCmpBase<RMobilePhone::TMobilePhoneLockInfoV1>
       
   144 	{
       
   145 public:
       
   146 	TCmpTMobilePhoneLockInfoV1NoStatus(RMobilePhone::TMobilePhoneLockInfoV1& aExpected, RMobilePhone::TMobilePhoneLockInfoV1& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
   147 	
       
   148 	virtual TBool IsEqual(TLogError aLogError);
       
   149 	}; // class TCmpTMobilePhoneLockInfoV1NoStatus
       
   150 
       
   151 
       
   152 class TCmpRPacketContextTContextConfigGPRS : public TCmpBase<RPacketContext::TContextConfigGPRS>
       
   153 	{
       
   154 	public:
       
   155     TCmpRPacketContextTContextConfigGPRS(RPacketContext::TContextConfigGPRS& aExpected, RPacketContext::TContextConfigGPRS& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
   156 	
       
   157     virtual TBool IsEqual(TLogError aLogError);
       
   158 	}; // class TCmpRPacketContextTContextConfigGPRS
       
   159 
       
   160 
       
   161 class TCmpRPacketContextTContextConfigR99_R4 : public TCmpBase<RPacketContext::TContextConfigR99_R4>
       
   162 	{
       
   163 	public:
       
   164     TCmpRPacketContextTContextConfigR99_R4(RPacketContext::TContextConfigR99_R4& aExpected, RPacketContext::TContextConfigR99_R4& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
   165 	
       
   166     virtual TBool IsEqual(TLogError aLogError);
       
   167 	}; // class TCmpRPacketContextTContextConfigR99_R4
       
   168 
       
   169 
       
   170 class TCmpRPacketContextTContextConfig_R5 : public TCmpBase<RPacketContext::TContextConfig_R5>
       
   171 	{
       
   172 	public:
       
   173     TCmpRPacketContextTContextConfig_R5(RPacketContext::TContextConfig_R5& aExpected, RPacketContext::TContextConfig_R5& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep);
       
   174 	
       
   175     virtual TBool IsEqual(TLogError aLogError);
       
   176 	}; // class TCmpRPacketContextTContextConfig_R5
       
   177 
       
   178 #endif // COMPARISONFUNCTIONS_H