os/ossrv/genericservices/httputils/Test/t_uriparser/CTextUtilsTest.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2001-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 "CTextUtilsTest.h"
    17 
    18 #include <uriutilscommon.h>
    19 #include <inetprottextutils.h>
    20 
    21 #include "TextUtilsTestCommon.h"
    22 #include "TextUtilsTests.h"
    23 
    24 CTextUtilsTest* CTextUtilsTest::NewLC(CIpuTestHarness* aTestHarness)
    25 	{
    26 	CTextUtilsTest* self = new (ELeave) CTextUtilsTest(aTestHarness);
    27 	CleanupStack::PushL(self);
    28 	self->ConstructL();
    29 	return self;
    30 	}
    31 
    32 CTextUtilsTest* CTextUtilsTest::NewL(CIpuTestHarness* aTestHarness)
    33 	{
    34 	CTextUtilsTest* self = CTextUtilsTest::NewLC(aTestHarness);
    35 	CleanupStack::Pop(self);
    36 	return self;
    37 	}
    38 
    39 CTextUtilsTest::CTextUtilsTest(CIpuTestHarness* aTestHarness)
    40 : iTestHarness(aTestHarness)
    41 	{
    42 	}
    43 
    44 void CTextUtilsTest::ConstructL()
    45 	{
    46 	}
    47 
    48 CTextUtilsTest::~CTextUtilsTest()
    49 	{
    50 	}
    51 
    52 void CTextUtilsTest::DoTestsL()
    53 	{
    54 
    55 	TestTextUtilsRemoveL(KRemove0_base, KRemove0_left, KRemove0_left_consumed,
    56 						KRemove0_right, KRemove0_right_consumed,
    57 						KRemove0_both, KRemove0_both_consumed);
    58 
    59 	TestTextUtilsDesToIntConversionL(KDecRep0, KNumericValue0, KIsValid0);
    60 	TestTextUtilsDesToIntConversionL(KDecRep1, KNumericValue1, KIsValid1);
    61 	TestTextUtilsDesToIntConversionL(KDecRep2, KNumericValue2, KIsValid2);
    62 	TestTextUtilsDesToIntConversionL(KDecRep3, KNumericValue3, KIsValid3);
    63 	
    64 	TestTextUtilsIntToDesConversionL(KNumericValue0, KDecRep0);
    65 	TestTextUtilsIntToDesConversionL(KNumericValue1, KDecRep1);
    66 
    67 	_LIT(KWhiteSpace," \t");
    68 	TestTextUtilsDesToHexConversionL(KWhiteSpace, 0, EFalse);
    69 
    70 	TestTextUtilsDesToHexConversionL(KHexRep0, KNumericValue0, KIsValid0);
    71 	TestTextUtilsDesToHexConversionL(KHexRep1, KNumericValue1, KIsValid1);
    72 	TestTextUtilsDesToHexConversionL(KHexRep2, KNumericValue2, KIsValid2);
    73 	TestTextUtilsDesToHexConversionL(KHexRep3, KNumericValue3, KIsValid3);
    74 
    75 	TestTextUtilsHexToDesConversionL(KNumericValue0, KHexRep0);
    76 	TestTextUtilsHexToDesConversionL(KNumericValue1, KHexRep1);
    77 
    78 	TestTextUtilsExtractQuotedStringL(KQuotedBuffer0, KQuotedString0, KQuotedRemainder0, KExpectedError0);
    79 	TestTextUtilsExtractQuotedStringL(KQuotedBuffer1, KQuotedString1, KQuotedRemainder1, KExpectedError1);
    80 	TestTextUtilsExtractQuotedStringL(KQuotedBuffer2, KQuotedString2, KQuotedRemainder2, KExpectedError2);
    81 	TestTextUtilsExtractQuotedStringL(KQuotedBuffer3, KQuotedString3, KQuotedRemainder3, KExpectedError3);
    82 
    83 	TestTextUtilsExtractTokenFromListL(
    84 									  KListBuffer0,
    85 									  KListToken0_0,
    86 									  KListToken0_1,
    87 									  KListToken0_2,
    88 									  KListRemainder0,
    89 									  KListSeparator0
    90 									  );
    91 
    92 	TestTextUtilsExtractTokenFromListL(
    93 									  KListBuffer1,
    94 									  KListToken1_0,
    95 									  KListToken1_1,
    96 									  KListToken1_2,
    97 									  KListRemainder1,
    98 									  KListSeparator1
    99 									  );
   100 
   101 	TestTextUtilsExtractTokenFromListL(
   102 									  KListBuffer2,
   103 									  KListToken2_0,
   104 									  KListToken2_1,
   105 									  KListToken2_2,
   106 									  KListRemainder2,
   107 									  KListSeparator2
   108 									  );
   109 
   110 	TestTextUtilsExtractTokenFromListL(
   111 									  KListBuffer3,
   112 									  KListToken3_0,
   113 									  KListToken3_1,
   114 									  KListToken3_2,
   115 									  KListRemainder3,
   116 									  KListSeparator3
   117 									  );
   118 	}
   119 
   120 void CTextUtilsTest::TestTextUtilsRemoveL(const TDesC& aBase, 
   121 										  const TDesC& aRemoveLeft, TInt aConsumedLeft,
   122 										  const TDesC& aRemoveRight, TInt aConsumedRight,
   123 										  const TDesC& aRemoveBoth, TInt aConsumedBoth)
   124 	{
   125 	iTestHarness->StartTestL(_L("Test TextUtils Remove (16-bit)"));
   126 
   127 	TInt error = DoTestTextUtilsRemove<TPtrC16>(aBase, aRemoveLeft, aConsumedLeft,
   128 												aRemoveRight, aConsumedRight,
   129 												aRemoveBoth, aConsumedBoth);
   130 
   131 	iTestHarness->EndTest(error);
   132 
   133 	// Make 8-bit copy
   134 	HBufC8* baseBuf = HBufC8::NewLC(aBase.Length());
   135 	TPtr8 base8Bit = baseBuf->Des();
   136 	base8Bit.Copy(aBase);
   137 
   138 	HBufC8* removeLeftBuf = HBufC8::NewLC(aRemoveLeft.Length());
   139 	TPtr8 removeLeft8Bit = removeLeftBuf->Des();
   140 	removeLeft8Bit.Copy(aRemoveLeft);
   141 
   142 	HBufC8* removeRightBuf = HBufC8::NewLC(aRemoveRight.Length());
   143 	TPtr8 removeRight8Bit = removeRightBuf->Des();
   144 	removeRight8Bit.Copy(aRemoveRight);
   145 
   146 	HBufC8* removeBothBuf = HBufC8::NewLC(aRemoveBoth.Length());
   147 	TPtr8 removeBoth8Bit = removeBothBuf->Des();
   148 	removeBoth8Bit.Copy(aRemoveBoth);
   149 
   150 	iTestHarness->StartTestL(_L("Test TextUtils Remove (8-bit)"));
   151 
   152 	error = DoTestTextUtilsRemove<TPtrC8>(base8Bit, removeLeft8Bit, aConsumedLeft,
   153 											removeRight8Bit, aConsumedRight,
   154 											removeBoth8Bit, aConsumedBoth);
   155 
   156 	iTestHarness->EndTest(error);
   157 
   158 	CleanupStack::PopAndDestroy(4, baseBuf);	// baseBuf, removeLeftBuf, removeRightBuf, removeBothBuf
   159 	}
   160 
   161 void CTextUtilsTest::TestTextUtilsDesToIntConversionL(const TDesC& aDes, TInt aInt, TBool aValid)
   162 	{
   163 	iTestHarness->StartTestL(_L("Test TextUtils ConvertDescriptorToInt (16-bit)"));
   164 
   165 	TInt error = DoTestTextUtilsDesToIntConversion(aDes, aInt, aValid);
   166 
   167 	iTestHarness->EndTest(error);
   168 
   169 	// Make 8-bit copy
   170 	HBufC8* desBuf = HBufC8::NewLC(aDes.Length());
   171 	TPtr8 des8Bit = desBuf->Des();
   172 	des8Bit.Copy(aDes);
   173 	
   174 	iTestHarness->StartTestL(_L("Test TextUtils ConvertDescriptorToInt (8-bit)"));
   175 
   176 	error = DoTestTextUtilsDesToIntConversion(des8Bit, aInt, aValid);
   177 
   178 	iTestHarness->EndTest(error);
   179 
   180 	CleanupStack::PopAndDestroy(desBuf);	// desBuf
   181 	}
   182 
   183 void CTextUtilsTest::TestTextUtilsIntToDesConversionL(TInt aInt, const TDesC& aDes)
   184 	{
   185 	iTestHarness->StartTestL(_L("Test TextUtils ConvertIntToDescriptor (16-bit)"));
   186 
   187 	TInt error = DoTestTextUtilsIntToDesConversion<HBufC16>(aInt, aDes);
   188 
   189 	iTestHarness->EndTest(error);
   190 
   191 	// Make 8-bit copy
   192 	HBufC8* desBuf = HBufC8::NewLC(aDes.Length());
   193 	TPtr8 des8Bit = desBuf->Des();
   194 	des8Bit.Copy(aDes);
   195 	
   196 	iTestHarness->StartTestL(_L("Test TextUtils ConvertIntToDescriptor (8-bit)"));
   197 
   198 	error = DoTestTextUtilsIntToDesConversion<HBufC8>(aInt, des8Bit);
   199 
   200 	iTestHarness->EndTest(error);
   201 
   202 	CleanupStack::PopAndDestroy(desBuf);	// desBuf
   203 	}
   204 
   205 
   206 
   207 void CTextUtilsTest::TestTextUtilsDesToHexConversionL(const TDesC& aDes, TInt aHexNumber, TBool aValid)
   208 	{
   209 	iTestHarness->StartTestL(_L("Test TextUtils ConvertDescriptorToHex (16-bit)"));
   210 
   211 	TInt error = DoTestTextUtilsDesToHexConversion(aDes, aHexNumber, aValid);
   212 	iTestHarness->EndTest(error);
   213 
   214 	// Test 8 bit version
   215 	TestTextUtilsDesToHexConversion8L(aDes, aHexNumber, aValid);
   216 	}
   217 	
   218 
   219 void CTextUtilsTest::TestTextUtilsDesToHexConversion8L(const TDesC& aDes, TInt aHexNumber, TBool aValid)
   220 	{
   221 	HBufC8* desBuf = HBufC8::NewLC(aDes.Length());
   222 	TPtr8 des8Bit = desBuf->Des();
   223 	des8Bit.Copy(aDes);
   224 	
   225 	iTestHarness->StartTestL(_L("Test TextUtils ConvertDescriptorToHex (8-bit)"));
   226 
   227 	TInt error = DoTestTextUtilsDesToHexConversion(des8Bit, aHexNumber, aValid);
   228 
   229 	iTestHarness->EndTest(error);
   230 
   231 	CleanupStack::PopAndDestroy(desBuf);	// desBuf
   232 	}
   233 	
   234 
   235 
   236 void CTextUtilsTest::TestTextUtilsHexToDesConversionL(TInt aHex, const TDesC& aDes)
   237 	{
   238 	iTestHarness->StartTestL(_L("Test TextUtils ConvertHexToDescriptor (16-bit)"));
   239 
   240 	TInt error = DoTestTextUtilsHexToDesConversion<HBufC16>(aHex, aDes);
   241 
   242 	iTestHarness->EndTest(error);
   243 
   244 	// Make 8-bit copy
   245 	HBufC8* desBuf = HBufC8::NewLC(aDes.Length());
   246 	TPtr8 des8Bit = desBuf->Des();
   247 	des8Bit.Copy(aDes);
   248 	
   249 	iTestHarness->StartTestL(_L("Test TextUtils ConvertHexToDescriptor (8-bit)"));
   250 
   251 	error = DoTestTextUtilsHexToDesConversion<HBufC8>(aHex, des8Bit);
   252 
   253 	iTestHarness->EndTest(error);
   254 
   255 	CleanupStack::PopAndDestroy(desBuf);	// desBuf
   256 	}
   257 
   258 void CTextUtilsTest::TestTextUtilsExtractQuotedStringL(
   259 													  const TDesC&	aBuffer, 
   260 													  const TDesC&	aString, 
   261 													  const TDesC&	aRemainder,
   262 													  TInt			aExpectedError
   263 													  )
   264 	{
   265 	iTestHarness->StartTestL(_L("Test TextUtils ExtractQuotedStringL (16-bit)"));
   266 
   267 	TInt error = DoTestExtractQuotedStringL<TPtrC>(aBuffer, aString, aRemainder, aExpectedError);
   268 
   269 	iTestHarness->EndTest(error);
   270 
   271 	// Make 8-bit copy
   272 	HBufC8* buffer = HBufC8::NewLC(aBuffer.Length());
   273 	buffer->Des().Copy(aBuffer);
   274 
   275 	HBufC8* string = HBufC8::NewLC(aString.Length());
   276 	string->Des().Copy(aString);
   277 
   278 	HBufC8* remainder = HBufC8::NewLC(aRemainder.Length());
   279 	remainder->Des().Copy(aRemainder);
   280 
   281 	iTestHarness->StartTestL(_L("Test TextUtils ExtractQuotedStringL (8-bit)"));
   282 
   283 	error = DoTestExtractQuotedStringL<TPtrC8>(*buffer, *string, *remainder, aExpectedError);
   284 
   285 	iTestHarness->EndTest(error);
   286 
   287 	CleanupStack::PopAndDestroy(3, buffer);
   288 	}
   289 
   290 void CTextUtilsTest::TestTextUtilsExtractTokenFromListL(
   291 													   const TDesC& aBuffer,
   292 													   const TDesC& aToken0,
   293 													   const TDesC& aToken1,
   294 													   const TDesC& aToken2,
   295 													   const TDesC& aRemainder,
   296 													   const TDesC& aSeparator
   297 													   )
   298 	{
   299 	iTestHarness->StartTestL(_L("Test TextUtils ExtractTokenFromList, multiple separator (16-bit)"));
   300 
   301 	TInt error = DoExtractTokenFromListMultipleSeparator<TPtrC>(aBuffer, aToken0, aToken1, aToken2, aRemainder, aSeparator);
   302 
   303 	iTestHarness->EndTest(error);
   304 
   305 	// Make 8-bit copy
   306 	HBufC8* buffer = HBufC8::NewLC(aBuffer.Length());
   307 	buffer->Des().Copy(aBuffer);
   308 
   309 	HBufC8* token0 = HBufC8::NewLC(aToken0.Length());
   310 	token0->Des().Copy(aToken0);
   311 
   312 	HBufC8* token1 = HBufC8::NewLC(aToken1.Length());
   313 	token1->Des().Copy(aToken1);
   314 
   315 	HBufC8* token2 = HBufC8::NewLC(aToken2.Length());
   316 	token2->Des().Copy(aToken2);
   317 
   318 	HBufC8* remainder = HBufC8::NewLC(aRemainder.Length());
   319 	remainder->Des().Copy(aRemainder);
   320 
   321 	HBufC8* separator = HBufC8::NewLC(aSeparator.Length());
   322 	separator->Des().Copy(aSeparator);
   323 
   324 	iTestHarness->StartTestL(_L("Test TextUtils ExtractTokenFromList, multiple separator (8-bit)"));
   325 
   326 	error = DoExtractTokenFromListMultipleSeparator<TPtrC8>(*buffer, *token0, *token1, *token2, *remainder, *separator);
   327 
   328 	iTestHarness->EndTest(error);
   329 
   330 	CleanupStack::PopAndDestroy(6, buffer);
   331 	}
   332 
   333 void CTextUtilsTest::TestTextUtilsExtractTokenFromListL(
   334 													   const TDesC& aBuffer,
   335 													   const TDesC& aToken0,
   336 													   const TDesC& aToken1,
   337 													   const TDesC& aToken2,
   338 													   const TDesC& aRemainder,
   339 													   TChar		aSeparator
   340 													   )
   341 	{
   342 	iTestHarness->StartTestL(_L("Test TextUtils ExtractTokenFromList, single separator (16-bit)"));
   343 
   344 	TInt error = DoExtractTokenFromListSingleSeparator<TPtrC>(aBuffer, aToken0, aToken1, aToken2, aRemainder, aSeparator);
   345 
   346 	iTestHarness->EndTest(error);
   347 
   348 	// Make 8-bit copy
   349 	HBufC8* buffer = HBufC8::NewLC(aBuffer.Length());
   350 	buffer->Des().Copy(aBuffer);
   351 
   352 	HBufC8* token0 = HBufC8::NewLC(aToken0.Length());
   353 	token0->Des().Copy(aToken0);
   354 
   355 	HBufC8* token1 = HBufC8::NewLC(aToken1.Length());
   356 	token1->Des().Copy(aToken1);
   357 
   358 	HBufC8* token2 = HBufC8::NewLC(aToken2.Length());
   359 	token2->Des().Copy(aToken2);
   360 
   361 	HBufC8* remainder = HBufC8::NewLC(aRemainder.Length());
   362 	remainder->Des().Copy(aRemainder);
   363 
   364 	iTestHarness->StartTestL(_L("Test TextUtils ExtractTokenFromList, single separator (8-bit)"));
   365 
   366 	error = DoExtractTokenFromListSingleSeparator<TPtrC8>(*buffer, *token0, *token1, *token2, *remainder, aSeparator);
   367 
   368 	iTestHarness->EndTest(error);
   369 
   370 	CleanupStack::PopAndDestroy(5, buffer);
   371 	}
   372 
   373 /*
   374  *	Local methods
   375  */
   376 
   377 template<class TPtrCType, class TDesCType>
   378 LOCAL_C TInt DoTestTextUtilsRemove(const TDesCType& aBase, 
   379 								   const TDesCType& aRemoveLeft, TInt aConsumedLeft,
   380 								   const TDesCType& aRemoveRight, TInt aConsumedRight,
   381 								   const TDesCType& aRemoveBoth, TInt aConsumedBoth)
   382 	{
   383 	// Do remove left...
   384 	TPtrCType data = aBase;
   385 	TInt consumed = InetProtTextUtils::RemoveWhiteSpace(data, InetProtTextUtils::ERemoveLeft);
   386 	// Check...
   387 	if( data.Compare(aRemoveLeft) != 0 || consumed != aConsumedLeft )
   388 		{
   389 		return KErrNotFound;
   390 		}
   391 	// Do remove right...
   392 	data.Set(aBase);
   393 	consumed = InetProtTextUtils::RemoveWhiteSpace(data, InetProtTextUtils::ERemoveRight);
   394 	// Check...
   395 	if( data.Compare(aRemoveRight) != 0 || consumed != aConsumedRight )
   396 		{
   397 		return KErrNotFound;
   398 		}
   399 	// Do remove both...
   400 	data.Set(aBase);
   401 	consumed = InetProtTextUtils::RemoveWhiteSpace(data, InetProtTextUtils::ERemoveBoth);
   402 	// Check...
   403 	if( data.Compare(aRemoveBoth) != 0 || consumed != aConsumedBoth )
   404 		{
   405 		return KErrNotFound;
   406 		}
   407 	return KErrNone;
   408 	}
   409 
   410 template<class TDesCType>
   411 LOCAL_C TInt DoTestTextUtilsDesToIntConversion(const TDesCType& aDes, TInt aInt, TBool aValid)
   412 	{
   413 	TInt theInt;
   414 	TInt error = InetProtTextUtils::ConvertDescriptorToInt(aDes, theInt);
   415 	if( (error < KErrNone && aValid) || (error >= KErrNone && !aValid) )
   416 		{
   417 		return KErrNotFound;
   418 		}
   419 	if( aValid && theInt != aInt )
   420 		{
   421 		return KErrNotFound;
   422 		}
   423 	return KErrNone;
   424 	}
   425 
   426 template<class HBufCType, class TDesCType>
   427 LOCAL_C TInt DoTestTextUtilsIntToDesConversion(TInt aInt, const TDesCType& aDes)
   428 	{
   429 	HBufCType* theDes = NULL;
   430 	TRAPD(error, InetProtTextUtils::ConvertIntToDescriptorL(aInt, theDes));
   431 	if( error != KErrNone )
   432 		{
   433 		return KErrNotFound;
   434 		}
   435 	if( theDes->CompareF(aDes) != 0 )
   436 		{
   437 		delete theDes;
   438 		return KErrNotFound;
   439 		}
   440 	delete theDes;
   441 	return KErrNone;
   442 	}
   443 
   444 template<class TDesCType>
   445 LOCAL_C TInt DoTestTextUtilsDesToHexConversion(const TDesCType& aDes, TInt aHex, TBool aValid)
   446 	{
   447 	TInt theHex;
   448 	TInt error = InetProtTextUtils::ConvertDescriptorToHex(aDes, theHex);
   449 	if( (error < KErrNone && aValid) || (error >= KErrNone && !aValid) )
   450 		{
   451 		return KErrNotFound;
   452 		}
   453 	if( aValid && theHex != aHex )
   454 		{
   455 		return KErrNotFound;
   456 		}
   457 	return KErrNone;
   458 	}
   459 
   460 template<class HBufCType, class TDesCType>
   461 LOCAL_C TInt DoTestTextUtilsHexToDesConversion(TInt aHex, const TDesCType& aDes)
   462 	{
   463 	HBufCType* theDes = NULL;
   464 	TRAPD(error, InetProtTextUtils::ConvertHexToDescriptorL(aHex, theDes));
   465 	if( error != KErrNone )
   466 		{
   467 		return KErrNotFound;
   468 		}
   469 	if( theDes->CompareF(aDes) != 0 )
   470 		{
   471 		delete theDes;
   472 		return KErrNotFound;
   473 		}
   474 	delete theDes;
   475 	return KErrNone;
   476 	}
   477 
   478 template<class TPtrCType, class TDesCType>
   479 LOCAL_C TInt DoTestExtractQuotedStringL(const TDesCType& aBuffer, const TDesCType& aString, const TDesCType& aRemainder, TInt aExpectedError)
   480 	{
   481 	TPtrCType buffer(aBuffer);
   482 	TPtrCType string;
   483 	TRAPD( error, InetProtTextUtils::ExtractQuotedStringL(buffer, string) );
   484 
   485 	if( error == KErrNone && aExpectedError == KErrNone)
   486 		{
   487 		if( aString.Compare(string) == 0 && aRemainder.Compare(buffer) == 0 )
   488 			{
   489 			// Passed
   490 			return KErrNone;
   491 			}
   492 		else
   493 			{
   494 			// Failed
   495 			return KErrNotFound;
   496 			}
   497 		}
   498 	else if( error == aExpectedError )
   499 		{
   500 		// Got expected error - passed
   501 		return KErrNone;
   502 		}
   503 	else
   504 		{
   505 		// Failed
   506 		return KErrNotFound;
   507 		}
   508 	}
   509 
   510 template<class TPtrCType, class TDesCType>
   511 LOCAL_C TInt DoExtractTokenFromListMultipleSeparator(
   512 												const TDesCType& aBuffer,
   513 												const TDesCType& aToken0,
   514 												const TDesCType& aToken1,
   515 												const TDesCType& aToken2,
   516 												const TDesCType& aRemainder,
   517 												const TDesCType& aSeparator
   518 												)
   519 	{
   520 	// get the first token...
   521 	TPtrCType buffer = aBuffer;
   522 	TPtrCType token;
   523 	InetProtTextUtils::ExtractNextTokenFromList(buffer, token, aSeparator);
   524 
   525 	// Is it correct?
   526 	if( token.Compare(aToken0) != 0 )
   527 		{
   528 		// Failed
   529 		return KErrNotFound;
   530 		}
   531 	// get the second token
   532 	InetProtTextUtils::ExtractNextTokenFromList(buffer, token, aSeparator);
   533 
   534 	// Is it correct?
   535 	if( token.Compare(aToken1) != 0 )
   536 		{
   537 		// Failed
   538 		return KErrNotFound;
   539 		}
   540 	// get the third token
   541 	InetProtTextUtils::ExtractNextTokenFromList(buffer, token, aSeparator);
   542 
   543 	// Is it correct?
   544 	if( token.Compare(aToken2) != 0 )
   545 		{
   546 		// Failed
   547 		return KErrNotFound;
   548 		}
   549 	// Check that the remainder is correct
   550 	if( buffer.Compare(aRemainder) != 0 )
   551 		{
   552 		// Failed
   553 		return KErrNotFound;
   554 		}
   555 	return KErrNone;
   556 	}
   557 
   558 template<class TPtrCType, class TDesCType>
   559 LOCAL_C TInt DoExtractTokenFromListSingleSeparator(
   560 												const TDesCType& aBuffer,
   561 												const TDesCType& aToken0,
   562 												const TDesCType& aToken1,
   563 												const TDesCType& aToken2,
   564 												const TDesCType& aRemainder,
   565 												TChar			 aSeparator
   566 												)
   567 	{
   568 	// get the first token...
   569 	TPtrCType buffer = aBuffer;
   570 	TPtrCType token;
   571 	InetProtTextUtils::ExtractNextTokenFromList(buffer, token, aSeparator);
   572 
   573 	// Is it correct?
   574 	if( token.Compare(aToken0) != 0 )
   575 		{
   576 		// Failed
   577 		return KErrNotFound;
   578 		}
   579 	// get the second token
   580 	InetProtTextUtils::ExtractNextTokenFromList(buffer, token, aSeparator);
   581 
   582 	// Is it correct?
   583 	if( token.Compare(aToken1) != 0 )
   584 		{
   585 		// Failed
   586 		return KErrNotFound;
   587 		}
   588 	// get the third token
   589 	InetProtTextUtils::ExtractNextTokenFromList(buffer, token, aSeparator);
   590 
   591 	// Is it correct?
   592 	if( token.Compare(aToken2) != 0 )
   593 		{
   594 		// Failed
   595 		return KErrNotFound;
   596 		}
   597 	// Check that the remainder is correct
   598 	if( buffer.Compare(aRemainder) != 0 )
   599 		{
   600 		// Failed
   601 		return KErrNotFound;
   602 		}
   603 	return KErrNone;
   604 	}