sl@0: /* sl@0: * Copyright (c) 2004-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 the License "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: sl@0: sl@0: #include sl@0: #include "tpaddingNone.h" sl@0: sl@0: CTestPadNone::CTestPadNone() sl@0: { sl@0: SetTestStepName(KPadNone); sl@0: } sl@0: sl@0: CTestPadNone::~CTestPadNone() sl@0: { sl@0: } sl@0: sl@0: TVerdict CTestPadNone::doTestStepL() sl@0: { sl@0: SetTestStepResult(EPass); sl@0: __UHEAP_MARK; sl@0: sl@0: INFO_PRINTF1(_L("Test of padding with type None")); sl@0: sl@0: TInt blockSize = 0; sl@0: if (GetIntFromConfig(ConfigSection(), _L("blocksize"), blockSize)) sl@0: { sl@0: ERR_PRINTF1(_L("Missing parameter - blockSize")); sl@0: } sl@0: sl@0: // Block size is arbitrary as no padding actually occurs sl@0: CPaddingNone *padding = CPaddingNone::NewLC(blockSize); sl@0: for (TInt i = 1 ; i < blockSize; i++) sl@0: { sl@0: HBufC8 *padInData = HBufC8::NewLC(i); sl@0: HBufC8 *padOutData = HBufC8::NewLC(i); sl@0: TPtr8 in(padInData->Des()); sl@0: TPtr8 out(padOutData->Des()); sl@0: for (TInt j = 0; j < i; j++) sl@0: { sl@0: in.Append(_L8("a")); sl@0: } sl@0: sl@0: // Perform the padding sl@0: TRAPD(err, padding->DoPadL(in, out)); sl@0: TEST(err == KErrNone); sl@0: sl@0: // As no padding actually occurs, the in string should equal the out string sl@0: TEST(in == out); sl@0: CleanupStack::PopAndDestroy(2, padInData); // padInData, padOutData sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(); // padding sl@0: __UHEAP_MARKEND; sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: CTestUnpadNone::CTestUnpadNone() sl@0: { sl@0: SetTestStepName(KUnpadNone); sl@0: } sl@0: sl@0: CTestUnpadNone::~CTestUnpadNone() sl@0: { sl@0: } sl@0: sl@0: TVerdict CTestUnpadNone::doTestStepL() sl@0: { sl@0: SetTestStepResult(EPass); sl@0: __UHEAP_MARK; sl@0: sl@0: INFO_PRINTF1(_L("Test of unpadding with type None")); sl@0: sl@0: TInt blockSize = 0; sl@0: if (GetIntFromConfig(ConfigSection(), _L("blocksize"), blockSize)) sl@0: { sl@0: ERR_PRINTF1(_L("Missing parameter - blockSize")); sl@0: } sl@0: sl@0: // Block size is arbitrary as no padding actually occurs sl@0: CPaddingNone *padding = CPaddingNone::NewLC(blockSize); sl@0: for (TInt i = 1 ; i < blockSize; i++) sl@0: { sl@0: HBufC8 *padInData = HBufC8::NewLC(i); sl@0: HBufC8 *padOutData = HBufC8::NewLC(i); sl@0: TPtr8 in(padInData->Des()); sl@0: TPtr8 out(padOutData->Des()); sl@0: for (TInt j = 0; j < i; j++) sl@0: { sl@0: in.Append(_L8("a")); sl@0: } sl@0: sl@0: // Perform the unpadding sl@0: TRAPD(err, padding->UnPadL(in, out)); sl@0: TEST(err == KErrNone); sl@0: sl@0: // As no unpadding actually occurs, the in string should equal the out string sl@0: TEST(in == out); sl@0: CleanupStack::PopAndDestroy(2, padInData); // padInData, padOutData sl@0: } sl@0: CleanupStack::PopAndDestroy(); // padding sl@0: __UHEAP_MARKEND; sl@0: return TestStepResult(); sl@0: } sl@0: