Update contrib.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #include "tpaddingNone.h"
22 CTestPadNone::CTestPadNone()
24 SetTestStepName(KPadNone);
27 CTestPadNone::~CTestPadNone()
31 TVerdict CTestPadNone::doTestStepL()
33 SetTestStepResult(EPass);
36 INFO_PRINTF1(_L("Test of padding with type None"));
39 if (!GetIntFromConfig(ConfigSection(), _L("blocksize"), blockSize))
41 ERR_PRINTF1(_L("Missing parameter - blockSize"));
44 // Block size is arbitrary as no padding actually occurs
45 CPaddingNone *padding = CPaddingNone::NewLC(blockSize);
46 for (TInt i = 1 ; i < blockSize; i++)
48 HBufC8 *padInData = HBufC8::NewLC(i);
49 HBufC8 *padOutData = HBufC8::NewLC(i);
50 TPtr8 in(padInData->Des());
51 TPtr8 out(padOutData->Des());
52 for (TInt j = 0; j < i; j++)
57 // Perform the padding
58 TRAPD(err, padding->PadL(in, out));
59 TEST(err == KErrNone);
61 // As no padding actually occurs, the in string should equal the out string
63 CleanupStack::PopAndDestroy(2, padInData); // padInData, padOutData
66 CleanupStack::PopAndDestroy(); // padding
68 return TestStepResult();
71 CTestUnpadNone::CTestUnpadNone()
73 SetTestStepName(KUnpadNone);
76 CTestUnpadNone::~CTestUnpadNone()
80 TVerdict CTestUnpadNone::doTestStepL()
82 SetTestStepResult(EPass);
85 INFO_PRINTF1(_L("Test of unpadding with type None"));
88 if (GetIntFromConfig(ConfigSection(), _L("blocksize"), blockSize))
90 ERR_PRINTF1(_L("Missing parameter - blockSize"));
93 // Block size is arbitrary as no padding actually occurs
94 CPaddingNone *padding = CPaddingNone::NewLC(blockSize);
95 for (TInt i = 1 ; i < blockSize; i++)
97 HBufC8 *padInData = HBufC8::NewLC(i);
98 HBufC8 *padOutData = HBufC8::NewLC(i);
99 TPtr8 in(padInData->Des());
100 TPtr8 out(padOutData->Des());
101 for (TInt j = 0; j < i; j++)
106 // Perform the unpadding
107 TRAPD(err, padding->UnPadL(in, out));
108 TEST(err == KErrNone);
110 // As no unpadding actually occurs, the in string should equal the out string
112 CleanupStack::PopAndDestroy(2, padInData); // padInData, padOutData
114 CleanupStack::PopAndDestroy(); // padding
116 return TestStepResult();