telephonyserverplugins/common_tsy/test/integration/src/comparisonfunctions.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 31 8ab6687fb94c
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 #include "comparisonfunctions.h"
       
    17 
       
    18 TCmpRCallTCallInfo::TCmpRCallTCallInfo
       
    19 	(RCall::TCallInfo& aExpected, RCall::TCallInfo& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
    20 	: TCmpBase<RCall::TCallInfo>(aExpected, aValue, aTestStep)
       
    21 	{
       
    22 	}
       
    23 
       
    24 TBool TCmpRCallTCallInfo::IsEqual(TLogError aLogError)
       
    25 /**
       
    26  * Check that all the parameters in RCall::TCallInfo are identical.
       
    27  */
       
    28 	{
       
    29 	if (iExpected.iCallName == iValue.iCallName &&
       
    30 		iExpected.iLineName == iValue.iLineName &&
       
    31 		iExpected.iHookStatus == iValue.iHookStatus &&
       
    32 		iExpected.iDuration == iValue.iDuration)
       
    33 		{
       
    34 		return ETrue;
       
    35 		}
       
    36 	else
       
    37 		{
       
    38 		if(aLogError == ELogError)
       
    39 			{
       
    40 			_LIT(KAssertRCallErrorEqualsTextA,"FAILURE");
       
    41 			_LIT(KAssertRCallErrorEqualsTextB," Got callname=%S,linename=%S,hookstatus=%d,duration=%d");
       
    42 			_LIT(KAssertRCallErrorEqualsTextC," Expected callname=%S,linename=%S,hookstatus=%d,duration=%d");
       
    43 			ERR_PRINTF1(KAssertRCallErrorEqualsTextA);
       
    44 			ERR_PRINTF5(KAssertRCallErrorEqualsTextB, &iExpected.iCallName, &iExpected.iLineName, iExpected.iHookStatus, iExpected.iDuration.Int() );
       
    45 			ERR_PRINTF5(KAssertRCallErrorEqualsTextC, &iValue.iCallName, &iValue.iLineName, iValue.iHookStatus, iValue.iDuration.Int() );	
       
    46 			}
       
    47 		return EFalse;
       
    48 		}
       
    49 	}
       
    50 	
       
    51 
       
    52 TCmpRCallTCallInfoNoHookValidName::TCmpRCallTCallInfoNoHookValidName
       
    53 	(RCall::TCallInfo& aExpected, RCall::TCallInfo& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
    54 	: TCmpBase<RCall::TCallInfo>(aExpected, aValue, aTestStep)
       
    55 	{
       
    56 	}
       
    57 	
       
    58 TBool TCmpRCallTCallInfoNoHookValidName::IsEqual(TLogError aLogError)
       
    59 /**
       
    60  * Check that the call name and line name are not empty,
       
    61  * call status is correct and duration is > 0.
       
    62  */
       
    63 	{
       
    64 	if(iExpected.iCallName.Length() > 0 &&
       
    65 			iExpected.iLineName.Length() > 0 &&
       
    66 			iExpected.iStatus == iValue.iStatus &&
       
    67 			iExpected.iDuration.Int() > 0)
       
    68 		{
       
    69 		return ETrue;
       
    70 		}
       
    71 	else
       
    72 		{
       
    73 		if(aLogError == ELogError)
       
    74 			{
       
    75 			_LIT(KAssertRCallErrorEqualsTextA,"FAILURE");
       
    76 			_LIT(KAssertRCallErrorEqualsTextB," Got callname=%S,linename=%S,status=%d,duration=%d");
       
    77 			_LIT(KAssertRCallErrorEqualsTextC," Expected callname=%S,linename=%S,status=%d,duration=%d");
       
    78 			ERR_PRINTF1(KAssertRCallErrorEqualsTextA);
       
    79 			ERR_PRINTF5(KAssertRCallErrorEqualsTextB, &iExpected.iCallName, &iExpected.iLineName, iExpected.iStatus, iExpected.iDuration.Int() );
       
    80 			ERR_PRINTF5(KAssertRCallErrorEqualsTextC, &iValue.iCallName, &iValue.iLineName, iValue.iStatus, iValue.iDuration.Int() );	
       
    81 			}
       
    82 		return EFalse;
       
    83 		}
       
    84 	}
       
    85 	
       
    86 TCmpRMobileCallTMobileCallCaps::TCmpRMobileCallTMobileCallCaps
       
    87 	(RMobileCall::TMobileCallCapsV1& aExpected, RMobileCall::TMobileCallCapsV1& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
    88 	: TCmpBase<RMobileCall::TMobileCallCapsV1>(aExpected, aValue, aTestStep)
       
    89 	{
       
    90 	}
       
    91 	
       
    92 TBool TCmpRMobileCallTMobileCallCaps::IsEqual(TLogError aLogError)
       
    93 /**
       
    94  * Check that the Call Control Caps and Call Event Caps flags are are as expected,
       
    95  */
       
    96 	{
       
    97 	if((  (iValue.iCallControlCaps & iExpected.iCallControlCaps) == iExpected.iCallControlCaps) &&
       
    98 		( (iValue.iCallEventCaps & iExpected.iCallEventCaps) == iExpected.iCallEventCaps))
       
    99 		{
       
   100 		return ETrue;
       
   101 		}
       
   102 	else
       
   103 		{
       
   104 		if(aLogError == ELogError)
       
   105 			{
       
   106 			_LIT(KAssertRCallErrorEqualsTextA,"FAILURE");
       
   107 			_LIT(KAssertRCallErrorEqualsTextB," Got CallControlCaps=0x%x,CallEventCaps=0x%x");
       
   108 			_LIT(KAssertRCallErrorEqualsTextC," Expected CallControlCaps=0x%x,CallEventCaps=0x%x");
       
   109 			ERR_PRINTF1(KAssertRCallErrorEqualsTextA);
       
   110 			ERR_PRINTF3(KAssertRCallErrorEqualsTextB, iValue.iCallControlCaps, iValue.iCallEventCaps);
       
   111 			ERR_PRINTF3(KAssertRCallErrorEqualsTextC, iExpected.iCallControlCaps, iExpected.iCallEventCaps);	
       
   112 			}
       
   113 		return EFalse;
       
   114 		}
       
   115 			
       
   116 			
       
   117 		
       
   118 	}	
       
   119 	
       
   120 
       
   121 TCmpRMobileCallTMobileCallRemotePartyInfo::TCmpRMobileCallTMobileCallRemotePartyInfo
       
   122 	(RMobileCall::TMobileCallRemotePartyInfoV1& aExpected, RMobileCall::TMobileCallRemotePartyInfoV1& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
   123 	: TCmpBase<RMobileCall::TMobileCallRemotePartyInfoV1>(aExpected, aValue, aTestStep)
       
   124 	{
       
   125 	}
       
   126 
       
   127 	
       
   128 TBool TCmpRMobileCallTMobileCallRemotePartyInfo::IsEqual(TLogError aLogError)
       
   129 /**
       
   130  * Check that the Direction and Remote Number flags are are as expected,
       
   131  */
       
   132 	{
       
   133 	if(( iValue.iDirection == iExpected.iDirection) &&
       
   134 		(iValue.iRemoteNumber.iTelNumber == iExpected.iRemoteNumber.iTelNumber) )
       
   135 		{
       
   136 		return ETrue;
       
   137 		}
       
   138 	else
       
   139 		{
       
   140 		if(aLogError == ELogError)
       
   141 			{
       
   142 			_LIT(KAssertRCallErrorEqualsTextA,"FAILURE");
       
   143 			_LIT(KAssertRCallErrorEqualsTextB," Got Direction=%X,Remote Number=%X");
       
   144 			_LIT(KAssertRCallErrorEqualsTextC," Expected Direction=%X,Remote Number=%X");
       
   145 			ERR_PRINTF1(KAssertRCallErrorEqualsTextA);
       
   146 			ERR_PRINTF3(KAssertRCallErrorEqualsTextB, &iValue.iDirection, &iValue.iRemoteNumber.iTelNumber);
       
   147 			ERR_PRINTF3(KAssertRCallErrorEqualsTextC,&iExpected.iDirection, &iExpected.iRemoteNumber.iTelNumber);	
       
   148 			}
       
   149 		return EFalse;
       
   150 		}
       
   151 	}	
       
   152 	
       
   153 
       
   154 
       
   155 TCmpTMobilePhoneLockInfoV1NoStatus::TCmpTMobilePhoneLockInfoV1NoStatus
       
   156 (RMobilePhone::TMobilePhoneLockInfoV1& aExpected, RMobilePhone::TMobilePhoneLockInfoV1& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
   157 : TCmpBase<RMobilePhone::TMobilePhoneLockInfoV1>(aExpected, aValue, aTestStep)
       
   158 {
       
   159 }
       
   160 
       
   161 TBool TCmpTMobilePhoneLockInfoV1NoStatus::IsEqual(TLogError aLogError)
       
   162 /**
       
   163 * Check that the required parameters in RMobilePhone::TMobilePhoneLockInfoV1 are identical.
       
   164 */
       
   165 {
       
   166 if (iExpected.iSetting == iValue.iSetting
       
   167 	 /* && iExpected.iStatus == iValue.iStatus*/)
       
   168 	{
       
   169 	return ETrue;
       
   170 	}
       
   171 else
       
   172 	{
       
   173 	if(aLogError == ELogError)
       
   174 		{
       
   175 		_LIT(KAssertRMobilePhoneErrorEqualsTextA,"FAILURE");
       
   176 		_LIT(KAssertRMobilePhoneErrorEqualsTextB," Got iSetting=%d, iStatus=%d");
       
   177 		_LIT(KAssertRMobilePhoneErrorEqualsTextC," Expected iSetting=%d, iStatus=%d");
       
   178 		ERR_PRINTF1(KAssertRMobilePhoneErrorEqualsTextA);
       
   179 		ERR_PRINTF3(KAssertRMobilePhoneErrorEqualsTextB, iExpected.iSetting,iExpected.iStatus);
       
   180 		ERR_PRINTF3(KAssertRMobilePhoneErrorEqualsTextC, iValue.iSetting, iValue.iStatus);	
       
   181 		}
       
   182 	return EFalse;
       
   183 	}
       
   184 }
       
   185 
       
   186 
       
   187 TCmpRPacketContextTContextConfigGPRS::TCmpRPacketContextTContextConfigGPRS
       
   188 	(RPacketContext::TContextConfigGPRS& aExpected, RPacketContext::TContextConfigGPRS& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
   189 	: TCmpBase<RPacketContext::TContextConfigGPRS>(aExpected, aValue, aTestStep)
       
   190 	{
       
   191 	}
       
   192 
       
   193 TBool TCmpRPacketContextTContextConfigGPRS::IsEqual(TLogError aLogError)
       
   194 /**
       
   195 * Check that the required parameters in RPacketContext::TContextConfigGPRS are identical.
       
   196 */
       
   197 	{
       
   198 	if(	iExpected.iAccessPointName == iValue.iAccessPointName &&
       
   199 		iExpected.iProtocolConfigOption.iAuthInfo.iUsername == iValue.iProtocolConfigOption.iAuthInfo.iUsername &&
       
   200 		iExpected.iProtocolConfigOption.iAuthInfo.iPassword == iValue.iProtocolConfigOption.iAuthInfo.iPassword)
       
   201 		{
       
   202 		return ETrue;
       
   203 		}
       
   204 
       
   205 	else
       
   206 		{
       
   207 		if(aLogError == ELogError)
       
   208 			{
       
   209 			_LIT(KAssertRPacketContextErrorEqualsTextA,"FAILURE");
       
   210 			_LIT(KAssertRPacketContextErrorEqualsTextB," Got apn=%S,username=%S,password=%S");
       
   211 			_LIT(KAssertRPacketContextErrorEqualsTextC," Expected apn=%S,username=%S,password=%S");
       
   212 			ERR_PRINTF1(KAssertRPacketContextErrorEqualsTextA);
       
   213 			ERR_PRINTF4(KAssertRPacketContextErrorEqualsTextB, 
       
   214 				&iValue.iAccessPointName,
       
   215 				&iValue.iProtocolConfigOption.iAuthInfo.iUsername,
       
   216 				&iValue.iProtocolConfigOption.iAuthInfo.iPassword);
       
   217 			ERR_PRINTF4(KAssertRPacketContextErrorEqualsTextC,
       
   218 				&iExpected.iAccessPointName,
       
   219 				&iExpected.iProtocolConfigOption.iAuthInfo.iUsername,
       
   220 				&iExpected.iProtocolConfigOption.iAuthInfo.iPassword);	
       
   221 			}
       
   222 		return EFalse;
       
   223 		}
       
   224 	}
       
   225 
       
   226 
       
   227 TCmpRPacketContextTContextConfigR99_R4::TCmpRPacketContextTContextConfigR99_R4
       
   228 	(RPacketContext::TContextConfigR99_R4& aExpected, RPacketContext::TContextConfigR99_R4& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
   229 	: TCmpBase<RPacketContext::TContextConfigR99_R4>(aExpected, aValue, aTestStep)
       
   230 	{
       
   231 	}
       
   232 
       
   233 TBool TCmpRPacketContextTContextConfigR99_R4::IsEqual(TLogError aLogError)
       
   234 /**
       
   235 * Check that the required parameters in RPacketContext::TContextConfigR99_R4 are identical.
       
   236 */
       
   237 	{
       
   238 	if(	iExpected.iAccessPointName == iValue.iAccessPointName &&
       
   239 		iExpected.iProtocolConfigOption.iAuthInfo.iUsername == iValue.iProtocolConfigOption.iAuthInfo.iUsername &&
       
   240 		iExpected.iProtocolConfigOption.iAuthInfo.iPassword == iValue.iProtocolConfigOption.iAuthInfo.iPassword)
       
   241 		{
       
   242 		return ETrue;
       
   243 		}
       
   244 
       
   245 	else
       
   246 		{
       
   247 		if(aLogError == ELogError)
       
   248 			{
       
   249 			_LIT(KAssertRPacketContextErrorEqualsTextA,"FAILURE");
       
   250 			_LIT(KAssertRPacketContextErrorEqualsTextB," Got apn=%S,username=%S,password=%S");
       
   251 			_LIT(KAssertRPacketContextErrorEqualsTextC," Expected apn=%S,username=%S,password=%S");
       
   252 			ERR_PRINTF1(KAssertRPacketContextErrorEqualsTextA);
       
   253 			ERR_PRINTF4(KAssertRPacketContextErrorEqualsTextB, 
       
   254 				&iValue.iAccessPointName,
       
   255 				&iValue.iProtocolConfigOption.iAuthInfo.iUsername,
       
   256 				&iValue.iProtocolConfigOption.iAuthInfo.iPassword);
       
   257 			ERR_PRINTF4(KAssertRPacketContextErrorEqualsTextC,
       
   258 				&iExpected.iAccessPointName,
       
   259 				&iExpected.iProtocolConfigOption.iAuthInfo.iUsername,
       
   260 				&iExpected.iProtocolConfigOption.iAuthInfo.iPassword);	
       
   261 			}
       
   262 		return EFalse;
       
   263 		}
       
   264 	}
       
   265 
       
   266 
       
   267 TCmpRPacketContextTContextConfig_R5::TCmpRPacketContextTContextConfig_R5
       
   268 	(RPacketContext::TContextConfig_R5& aExpected, RPacketContext::TContextConfig_R5& aValue, CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
   269 	: TCmpBase<RPacketContext::TContextConfig_R5>(aExpected, aValue, aTestStep)
       
   270 	{
       
   271 	}
       
   272 
       
   273 TBool TCmpRPacketContextTContextConfig_R5::IsEqual(TLogError aLogError)
       
   274 /**
       
   275 * Check that the required parameters in RPacketContext::TContextConfig_R5 are identical.
       
   276 */
       
   277 	{
       
   278 	if(	iExpected.iAccessPointName == iValue.iAccessPointName &&
       
   279 		iExpected.iProtocolConfigOption.iAuthInfo.iUsername == iValue.iProtocolConfigOption.iAuthInfo.iUsername &&
       
   280 		iExpected.iProtocolConfigOption.iAuthInfo.iPassword == iValue.iProtocolConfigOption.iAuthInfo.iPassword)
       
   281 		{
       
   282 		return ETrue;
       
   283 		}
       
   284 
       
   285 	else
       
   286 		{
       
   287 		if(aLogError == ELogError)
       
   288 			{
       
   289 			_LIT(KAssertRPacketContextErrorEqualsTextA,"FAILURE");
       
   290 			_LIT(KAssertRPacketContextErrorEqualsTextB," Got apn=%S,username=%S,password=%S");
       
   291 			_LIT(KAssertRPacketContextErrorEqualsTextC," Expected apn=%S,username=%S,password=%S");
       
   292 			ERR_PRINTF1(KAssertRPacketContextErrorEqualsTextA);
       
   293 			ERR_PRINTF4(KAssertRPacketContextErrorEqualsTextB, 
       
   294 				&iValue.iAccessPointName,
       
   295 				&iValue.iProtocolConfigOption.iAuthInfo.iUsername,
       
   296 				&iValue.iProtocolConfigOption.iAuthInfo.iPassword);
       
   297 			ERR_PRINTF4(KAssertRPacketContextErrorEqualsTextC,
       
   298 				&iExpected.iAccessPointName,
       
   299 				&iExpected.iProtocolConfigOption.iAuthInfo.iUsername,
       
   300 				&iExpected.iProtocolConfigOption.iAuthInfo.iPassword);	
       
   301 			}
       
   302 		return EFalse;
       
   303 		}
       
   304 	}
       
   305