First public contribution.
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.
20 #include "tconstructionfb.h"
25 CTestAction* CConstructionFB::NewL(RFs& aFs, CConsoleBase& aConsole,
26 Output& aOut, const TTestActionSpec& aTestActionSpec)
28 CTestAction* self = CConstructionFB::NewLC(aFs, aConsole,
29 aOut, aTestActionSpec);
34 CTestAction* CConstructionFB::NewLC(RFs& aFs, CConsoleBase& aConsole,
35 Output& aOut, const TTestActionSpec& aTestActionSpec)
37 CConstructionFB* self = new(ELeave) CConstructionFB(aFs, aConsole, aOut);
38 CleanupStack::PushL(self);
39 self->ConstructL(aTestActionSpec);
43 CConstructionFB::~CConstructionFB()
47 CConstructionFB::CConstructionFB(RFs& aFs, CConsoleBase& aConsole, Output& aOut)
48 : CTestAction(aConsole, aOut), iFs(aFs)
52 void CConstructionFB::ConstructL(const TTestActionSpec& aTestActionSpec)
54 CTestAction::ConstructL(aTestActionSpec);
57 void CConstructionFB::DoPerformPrerequisite(TRequestStatus& aStatus)
59 TRequestStatus* status = &aStatus;
60 User::RequestComplete(status, KErrNone);
61 iActionState = CTestAction::EAction;
64 void CConstructionFB::DoPerformPostrequisite(TRequestStatus& aStatus)
66 TRequestStatus* status = &aStatus;
68 User::RequestComplete(status, KErrNone);
71 void CConstructionFB::DoReportAction(void)
75 void CConstructionFB::DoCheckResult(TInt)
79 void CConstructionFB::PerformAction(TRequestStatus& aStatus)
82 TRequestStatus* status = &aStatus;
85 //Generate 100 i*5 byte random sequences
87 // - NewLC(const TDesC8&)
88 // - NewLC(const RInteger&)
90 // By comparing the output of BufferLC we can have (some) assurance
91 // that the internal integer code is intrepreting strings in the correct
92 // order and endianess
93 for(TUint i=0; i<100; i++)
95 HBufC8* buf = HBufC8::NewMaxLC(i*5);
96 TPtr8 ptr = buf->Des();
97 TRandom::RandomL(ptr);
99 RInteger a = RInteger::NewL(ptr);
100 CleanupStack::PushL(a);
101 HBufC8* out = a.BufferLC();
106 CleanupStack::PopAndDestroy(out);
108 RInteger b = RInteger::NewL(a);
109 CleanupStack::PushL(b);
119 CleanupStack::PopAndDestroy(out);
120 CleanupStack::PopAndDestroy(); //b
121 CleanupStack::PopAndDestroy();//a
122 CleanupStack::PopAndDestroy(buf);
125 User::RequestComplete(status, KErrNone);
126 iActionState = CTestAction::EPostrequisite;