1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericservices/httputils/Test/t_uriparser/CTextUtilsTest.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,130 @@
1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __CTEXTUTILSTEST_H__
1.20 +#define __CTEXTUTILSTEST_H__
1.21 +
1.22 +#include <e32base.h>
1.23 +
1.24 +#include "IpuTestUtils.h"
1.25 +#include "ctestbase.h"
1.26 +
1.27 +class CTextUtilsTest : public CTestBase
1.28 + {
1.29 +public:
1.30 +
1.31 + // Static factory c'tor.
1.32 + //
1.33 + // Rtn: pointer to newly created object - ownership transfered to caller.
1.34 + //
1.35 + static CTextUtilsTest* NewLC(CIpuTestHarness* aTestHarness);
1.36 +
1.37 + // Static factory c'tor.
1.38 + //
1.39 + // Rtn: pointer to newly created object - ownership transfered to caller.
1.40 + //
1.41 + static CTextUtilsTest* NewL(CIpuTestHarness* aTestHarness);
1.42 +
1.43 + // D'tor
1.44 + //
1.45 + ~CTextUtilsTest();
1.46 +
1.47 + // Does the tests
1.48 + //
1.49 + void DoTestsL();
1.50 +
1.51 +private:
1.52 +
1.53 + // C'tor
1.54 + //
1.55 + CTextUtilsTest(CIpuTestHarness* aTestHarness);
1.56 +
1.57 + // 2nd phase construction
1.58 + //
1.59 + void ConstructL();
1.60 +
1.61 + // Tests RemoveWhitespace
1.62 + //
1.63 + // In:
1.64 + // aData - the data
1.65 + // aExpectedLeft - expected result of removing left-most whitespace
1.66 + // aConsumedLeft - the number of cosumed whitespaces from the left
1.67 + // aExpectedRight - expected result of removing right-most whitespace
1.68 + // aConsumedRight - the number of cosumed whitespaces from the right
1.69 + // aExpectedBoth - expected result of removing left- and right-most whitespace
1.70 + // aConsumedBoth - the number of cosumed whitespaces from the left and right
1.71 + //
1.72 + void TestTextUtilsRemoveL(const TDesC& aBase, const TDesC& aRemoveLeft, TInt aConsumedLeft,
1.73 + const TDesC& aRemoveRight, TInt aConsumedRight,
1.74 + const TDesC& aRemoveBoth, TInt aConsumedBoth);
1.75 +
1.76 + // Tests ConvertDescriptorToInt
1.77 + //
1.78 + // In:
1.79 + // aDes - the descriptor
1.80 + // aInt - expected int value (any number if aValid is EFalse)
1.81 + // aValid - indicates whether aDes is a valid int representation.
1.82 + //
1.83 + void TestTextUtilsDesToIntConversionL(const TDesC& aDes, TInt aInt, TBool aValid);
1.84 +
1.85 + // Tests ConvertIntToDescriptor
1.86 + //
1.87 + // In:
1.88 + // aInt - the int value
1.89 + // aDes - the expecteddescriptor
1.90 + //
1.91 + void TestTextUtilsIntToDesConversionL(TInt aInt, const TDesC& aDes);
1.92 +
1.93 + void TestTextUtilsDesToHexConversionL(const TDesC& aDes, TInt aHex, TBool aValid);
1.94 + void TestTextUtilsDesToHexConversion8L(const TDesC& aDes, TInt aHex, TBool aValid);
1.95 +
1.96 +
1.97 + void TestTextUtilsHexToDesConversionL(TInt aHex, const TDesC& aDes);
1.98 +
1.99 + void TestTextUtilsExtractQuotedStringL(
1.100 + const TDesC& aBuffer,
1.101 + const TDesC& aString,
1.102 + const TDesC& aRemainder,
1.103 + TInt aExpectedError
1.104 + );
1.105 +
1.106 + void TestTextUtilsExtractTokenFromListL(
1.107 + const TDesC& aBuffer,
1.108 + const TDesC& aToken0,
1.109 + const TDesC& aToken1,
1.110 + const TDesC& aToken2,
1.111 + const TDesC& aRemainder,
1.112 + const TDesC& aSeparator
1.113 + );
1.114 +
1.115 + void TestTextUtilsExtractTokenFromListL(
1.116 + const TDesC& aBuffer,
1.117 + const TDesC& aToken0,
1.118 + const TDesC& aToken1,
1.119 + const TDesC& aToken2,
1.120 + const TDesC& aRemainder,
1.121 + TChar aSeparator
1.122 + );
1.123 +
1.124 +private: // Attributes
1.125 +
1.126 + // Test harness
1.127 + //
1.128 + CIpuTestHarness* iTestHarness;
1.129 +
1.130 + };
1.131 +
1.132 +#endif // __CTEXTUTILSTEST_H__
1.133 +