commsfwtools/preparedefaultcommsdatabase/te_commsdat/src/commsdatUtilityFunctionTests.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-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 // CCommsdat115Step
       
    15 // CCommsdat116Step
       
    16 // CCommsdat117Step
       
    17 // CCommsdat118Step
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file commsdatUtilityFunctionTests.cpp
       
    23 */
       
    24  
       
    25 #include "commsdatUtilityFunctionTests.h"
       
    26 #include "Te_commsdatSuiteDefs.h"
       
    27 #include <e32test.h>
       
    28  
       
    29 const TInt KLocationRecordId = 41;
       
    30 const TInt KChargecardRecordId = 0;
       
    31 //----------------------------------------------------------------------------------------------------------------
       
    32 CCommsdat115Step::CCommsdat115Step()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KCommsdat115Step);                                                                                           
       
    38 	}
       
    39 
       
    40 
       
    41 TVerdict CCommsdat115Step::doTestStepL()
       
    42 /**
       
    43  * @return - TVerdict code
       
    44  * Resolve mobile phone number for displaying
       
    45  * CED -i Z:\testdata\configs\te_commsdat_location_table2.cfg
       
    46  */
       
    47 	{
       
    48     SetTestStepResult(EFail);	
       
    49 	INFO_PRINTF1(_L("Testing resolving phone number in CCommsdat115Step::doTestStepL() "));
       
    50 	
       
    51 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
    52 	CleanupStack::PushL(utils);
       
    53 	
       
    54 	_LIT(KNumber, "6294841");
       
    55 	TPtrC number(KNumber);
       
    56 	TBuf<50> dialString;
       
    57 	
       
    58 	utils->ResolvePhoneNumberL(number, dialString, EForDisplay, KLocationRecordId, KChargecardRecordId);
       
    59 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
    60 	
       
    61 	// resolve of a mobile number gives you back the original number - see CCommsDatUtilImpl::ResolvePhoneNumberFromDatabaseL()
       
    62 	if(dialString == KNumber)
       
    63 		{
       
    64 		SetTestStepResult(EPass);
       
    65 		}
       
    66 	
       
    67 	CleanupStack::PopAndDestroy(utils);
       
    68 	return TestStepResult();
       
    69 	}
       
    70 	
       
    71 //----------------------------------------------------------------------------------------------------------------
       
    72 CCommsdat116Step::CCommsdat116Step()
       
    73 /**
       
    74  * Constructor
       
    75  */
       
    76 	{
       
    77 	SetTestStepName(KCommsdat116Step);                                                                                           
       
    78 	}
       
    79 
       
    80 TVerdict CCommsdat116Step::doTestStepL()
       
    81 /**
       
    82  * @return - TVerdict code
       
    83  * Resolve mobile phone number for dialing
       
    84  * CED -i Z:\testdata\configs\te_commsdat_location_table2.cfg
       
    85  */
       
    86 	{
       
    87     SetTestStepResult(EFail);	
       
    88 	INFO_PRINTF1(_L("Testing resolving phone number in CCommsdat116Step::doTestStepL() "));
       
    89 	
       
    90 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
    91 	CleanupStack::PushL(utils);
       
    92 	
       
    93 	_LIT(KNumber, "6294841");
       
    94 	TPtrC number(KNumber);
       
    95 	TBuf<50> dialString;
       
    96 
       
    97 	utils->ResolvePhoneNumberL(number, dialString, EForDialing, KLocationRecordId, KChargecardRecordId);
       
    98 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
    99 	
       
   100 	// resolve of a mobile number gives you back the original number - see CCommsDatUtilImpl::ResolvePhoneNumberFromDatabaseL()
       
   101 	if(dialString == KNumber)
       
   102 		{
       
   103 		SetTestStepResult(EPass);
       
   104 		}
       
   105 	
       
   106 	CleanupStack::PopAndDestroy(utils);
       
   107 	return TestStepResult();
       
   108 	}
       
   109 	
       
   110 //----------------------------------------------------------------------------------------------------------------
       
   111 CCommsdat117Step::CCommsdat117Step()
       
   112 /**
       
   113  * Constructor
       
   114  */
       
   115 	{
       
   116 	SetTestStepName(KCommsdat117Step);                                                                                           
       
   117 	}
       
   118 
       
   119 TVerdict CCommsdat117Step::doTestStepL()
       
   120 /**
       
   121  * @return - TVerdict code
       
   122  * Resolve non-mobile phone number for displaying
       
   123  * CED -i Z:\testdata\configs\te_commsdat_location_table3.cfg
       
   124  */
       
   125 	{
       
   126     SetTestStepResult(EFail);	
       
   127 	INFO_PRINTF1(_L("Testing resolving phone number in CCommsdat117Step::doTestStepL() "));
       
   128 	
       
   129 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   130 	CleanupStack::PushL(utils);
       
   131 	
       
   132 	TPtrC number(_L("6294841"));
       
   133 	TBuf<50> dialString;
       
   134 
       
   135 	utils->ResolvePhoneNumberL(number, dialString, EForDisplay, KLocationRecordId, KChargecardRecordId);
       
   136 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
   137 	
       
   138 	// 8 is disable call waiting, 9 is local call hence no international code or dialling code
       
   139 	_LIT(KExpectedNumber, "89,6294841");
       
   140 	
       
   141 	if(dialString == KExpectedNumber)
       
   142 		{
       
   143 		SetTestStepResult(EPass);
       
   144 		}
       
   145 	
       
   146 	CleanupStack::PopAndDestroy(utils);
       
   147 	return TestStepResult();
       
   148 	}
       
   149 
       
   150 //----------------------------------------------------------------------------------------------------------------
       
   151 CCommsdat118Step::CCommsdat118Step()
       
   152 /**
       
   153  * Constructor
       
   154  */
       
   155 	{
       
   156 	SetTestStepName(KCommsdat118Step);                                                                                           
       
   157 	}
       
   158 
       
   159 TVerdict CCommsdat118Step::doTestStepL()
       
   160 /**
       
   161  * @return - TVerdict code
       
   162  * Resolve non-mobile phone number for dialing
       
   163  * CED -i Z:\testdata\configs\te_commsdat_location_table3.cfg
       
   164  */
       
   165 	{
       
   166     SetTestStepResult(EFail);	
       
   167 	INFO_PRINTF1(_L("Testing resolving phone number in CCommsdat118Step::doTestStepL() "));
       
   168 	
       
   169 	CCommsDatUtils *utils = CCommsDatUtils::NewL();
       
   170 	CleanupStack::PushL(utils);
       
   171 	
       
   172 	TPtrC number(_L("6294841"));
       
   173 	TBuf<50> dialString;
       
   174 	
       
   175 	utils->ResolvePhoneNumberL(number, dialString, EForDialing, KLocationRecordId, KChargecardRecordId);
       
   176 	INFO_PRINTF2(_L("result: %S"), &dialString);
       
   177 	
       
   178 	// 8 is disable call waiting, 9 is local call hence no international code or dialling code
       
   179 	_LIT(KExpectedNumber, "8WT9,P6294841");
       
   180 	
       
   181 	if(dialString == KExpectedNumber)
       
   182 		{
       
   183 		SetTestStepResult(EPass);
       
   184 		}
       
   185 	
       
   186 	CleanupStack::PopAndDestroy(utils);
       
   187 	return TestStepResult();
       
   188 	}
       
   189 //----------------------------------------------------------------------------------------------------------------
       
   190 
       
   191