|
1 /* |
|
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * T_TESTSPEC.CPP |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "tTestSpec.h" |
|
21 #include "t_testaction.h" |
|
22 |
|
23 EXPORT_C CTestSpec* CTestSpec::NewL() |
|
24 { |
|
25 CTestSpec* self = new(ELeave) CTestSpec(); |
|
26 return self; |
|
27 } |
|
28 |
|
29 CTestSpec::CTestSpec() |
|
30 { |
|
31 } |
|
32 |
|
33 CTestSpec::~CTestSpec() |
|
34 { |
|
35 iTestActionArray.ResetAndDestroy(); |
|
36 iTestActionArray.Close(); |
|
37 } |
|
38 |
|
39 EXPORT_C TBool CTestSpec::GetNextTest(CTestAction*& aAction) |
|
40 { |
|
41 // Delete the previous test to free memory up for use by later tests |
|
42 TInt prevTest = iTestNumber - 1; |
|
43 if (prevTest >= 0 && prevTest < iTestActionArray.Count()) |
|
44 { |
|
45 delete iTestActionArray[prevTest]; |
|
46 iTestActionArray[prevTest] = NULL; |
|
47 } |
|
48 |
|
49 if (iTestNumber >= iTestActionArray.Count()) |
|
50 { |
|
51 return EFalse; |
|
52 } |
|
53 |
|
54 aAction=iTestActionArray[iTestNumber]; |
|
55 ++iTestNumber; |
|
56 |
|
57 return ETrue; |
|
58 } |
|
59 |
|
60 EXPORT_C TInt CTestSpec::AddNextTest(CTestAction* aAction) |
|
61 { |
|
62 return iTestActionArray.Append(aAction); |
|
63 } |
|
64 |
|
65 void CTestSpec::FreeAllTests() |
|
66 { |
|
67 iTestActionArray.ResetAndDestroy(); |
|
68 } |