Update contrib.
2 * Copyright (c) 2002-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.
19 #include "tconstructionvector.h"
23 class RIntegerTest : public RInteger
27 RIntegerTest(const RInteger& aInteger) {iSize = *((TUint*)&aInteger); iPtr = *(((TUint*)(&aInteger)+1)); }
28 TUint* Ptr(void) {return RInteger::Ptr();}
31 CTestAction* CConstructionVector::NewL(RFs& aFs, CConsoleBase& aConsole,
32 Output& aOut, const TTestActionSpec& aTestActionSpec)
34 CTestAction* self = CConstructionVector::NewLC(aFs, aConsole,
35 aOut, aTestActionSpec);
40 CTestAction* CConstructionVector::NewLC(RFs& aFs, CConsoleBase& aConsole,
41 Output& aOut, const TTestActionSpec& aTestActionSpec)
43 CConstructionVector* self = new(ELeave) CConstructionVector(aFs, aConsole, aOut);
44 CleanupStack::PushL(self);
45 self->ConstructL(aTestActionSpec);
49 CConstructionVector::~CConstructionVector()
56 CConstructionVector::CConstructionVector(RFs& aFs, CConsoleBase& aConsole, Output& aOut)
57 : CTestAction(aConsole, aOut), iFs(aFs)
61 void CConstructionVector::ConstructL(const TTestActionSpec& aTestActionSpec)
63 CTestAction::ConstructL(aTestActionSpec);
64 iBody = HBufC8::NewL(aTestActionSpec.iActionBody.Length());
65 iBody->Des().Copy(aTestActionSpec.iActionBody);
67 iString = Input::ParseElementHexL(*iBody, _L8("<input>"));
68 iMemoryLayout = Input::ParseElementHexL(*iBody, _L8("<memorylayout>"));
71 void CConstructionVector::DoPerformPrerequisite(TRequestStatus& aStatus)
73 TRequestStatus* status = &aStatus;
74 User::RequestComplete(status, KErrNone);
75 iActionState = CTestAction::EAction;
78 void CConstructionVector::DoPerformPostrequisite(TRequestStatus& aStatus)
80 TRequestStatus* status = &aStatus;
82 User::RequestComplete(status, KErrNone);
85 void CConstructionVector::DoReportAction(void)
89 void CConstructionVector::DoCheckResult(TInt)
93 void CConstructionVector::PerformAction(TRequestStatus& aStatus)
96 TRequestStatus* status = &aStatus;
99 //This is just a derived class to get around the fact that iReg is
100 //protected in RInteger. See top of file for definition
102 //a = (RIntegerTest)(RInteger::NewL(*iString));
103 a = static_cast<RIntegerTest>(RIntegerTest::NewL(*iString));
104 CleanupStack::PushL(a);
106 //This test ensures that the internal memory layout of a number is correct
107 TUint compare = Mem::Compare((TUint8*)(a.Ptr()), a.ByteCount(),
108 iMemoryLayout->Ptr(), iMemoryLayout->Size());
114 HBufC8* out = a.BufferLC();
115 if( *out != *iString )
119 CleanupStack::PopAndDestroy(out);
120 CleanupStack::PopAndDestroy(&a);
122 User::RequestComplete(status, KErrNone);
123 iActionState = CTestAction::EPostrequisite;