sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef __CTEXTUTILSTEST_H__
sl@0: #define __CTEXTUTILSTEST_H__
sl@0: 
sl@0: #include <e32base.h>
sl@0: 
sl@0: #include "IpuTestUtils.h"
sl@0: #include "ctestbase.h"
sl@0: 
sl@0: class CTextUtilsTest : public CTestBase
sl@0: 	{
sl@0: public:
sl@0: 
sl@0: 	// Static factory c'tor.
sl@0: 	//
sl@0: 	// Rtn: pointer to newly created object - ownership transfered to caller.
sl@0: 	//
sl@0: 	static CTextUtilsTest* NewLC(CIpuTestHarness* aTestHarness);
sl@0: 
sl@0: 	// Static factory c'tor.
sl@0: 	//
sl@0: 	// Rtn: pointer to newly created object - ownership transfered to caller.
sl@0: 	//
sl@0: 	static CTextUtilsTest* NewL(CIpuTestHarness* aTestHarness);
sl@0: 
sl@0: 	// D'tor
sl@0: 	//
sl@0: 	~CTextUtilsTest();
sl@0: 
sl@0: 	// Does the tests
sl@0: 	//
sl@0: 	void DoTestsL();
sl@0: 
sl@0: private:
sl@0: 
sl@0: 	// C'tor
sl@0: 	//
sl@0: 	CTextUtilsTest(CIpuTestHarness* aTestHarness);
sl@0: 
sl@0: 	// 2nd phase construction
sl@0: 	//
sl@0: 	void ConstructL();
sl@0: 
sl@0: 	// Tests RemoveWhitespace
sl@0: 	//
sl@0: 	// In:
sl@0: 	// aData			- the data
sl@0: 	// aExpectedLeft	- expected result of removing left-most whitespace
sl@0: 	// aConsumedLeft	- the number of cosumed whitespaces from the left
sl@0: 	// aExpectedRight	- expected result of removing right-most whitespace
sl@0: 	// aConsumedRight	- the number of cosumed whitespaces from the right
sl@0: 	// aExpectedBoth	- expected result of removing left- and right-most whitespace
sl@0: 	// aConsumedBoth	- the number of cosumed whitespaces from the left and right
sl@0: 	//
sl@0: 	void TestTextUtilsRemoveL(const TDesC& aBase, const TDesC& aRemoveLeft, TInt aConsumedLeft,
sl@0: 							const TDesC& aRemoveRight, TInt aConsumedRight,
sl@0: 							const TDesC& aRemoveBoth, TInt aConsumedBoth);
sl@0: 
sl@0: 	// Tests ConvertDescriptorToInt
sl@0: 	//
sl@0: 	// In:
sl@0: 	// aDes		- the descriptor
sl@0: 	// aInt		- expected int value (any number if aValid is EFalse)
sl@0: 	// aValid	- indicates whether aDes is a valid int representation.
sl@0: 	//
sl@0: 	void TestTextUtilsDesToIntConversionL(const TDesC& aDes, TInt aInt, TBool aValid);
sl@0: 
sl@0: 	// Tests ConvertIntToDescriptor
sl@0: 	//
sl@0: 	// In:
sl@0: 	// aInt		- the int value
sl@0: 	// aDes		- the expecteddescriptor
sl@0: 	//
sl@0: 	void TestTextUtilsIntToDesConversionL(TInt aInt, const TDesC& aDes);
sl@0: 
sl@0: 	void TestTextUtilsDesToHexConversionL(const TDesC& aDes, TInt aHex, TBool aValid);
sl@0: 	void TestTextUtilsDesToHexConversion8L(const TDesC& aDes, TInt aHex, TBool aValid);
sl@0: 
sl@0: 
sl@0: 	void TestTextUtilsHexToDesConversionL(TInt aHex, const TDesC& aDes);
sl@0: 
sl@0: 	void TestTextUtilsExtractQuotedStringL(
sl@0: 										  const TDesC&	aBuffer, 
sl@0: 										  const TDesC&	aString, 
sl@0: 										  const TDesC&	aRemainder,
sl@0: 										  TInt			aExpectedError
sl@0: 										  );
sl@0: 
sl@0: 	void TestTextUtilsExtractTokenFromListL(
sl@0: 										   const TDesC& aBuffer,
sl@0: 										   const TDesC& aToken0,
sl@0: 										   const TDesC& aToken1,
sl@0: 										   const TDesC& aToken2,
sl@0: 										   const TDesC& aRemainder,
sl@0: 										   const TDesC& aSeparator
sl@0: 										   );
sl@0: 
sl@0: 	void TestTextUtilsExtractTokenFromListL(
sl@0: 										   const TDesC& aBuffer,
sl@0: 										   const TDesC& aToken0,
sl@0: 										   const TDesC& aToken1,
sl@0: 										   const TDesC& aToken2,
sl@0: 										   const TDesC& aRemainder,
sl@0: 										   TChar		aSeparator
sl@0: 										   );
sl@0: 
sl@0: private:	// Attributes
sl@0: 
sl@0: 	// Test harness
sl@0: 	//
sl@0: 	CIpuTestHarness*	iTestHarness;
sl@0: 
sl@0: 	};
sl@0: 
sl@0: #endif	// __CTEXTUTILSTEST_H__
sl@0: