|
1 /* |
|
2 * Copyright (c) 2005-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 "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 * Example CTestStep derived implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file te_regperformancelowmemoryteststep.cpp |
|
23 @internalTechnology |
|
24 */ |
|
25 #include <stdlib.h> |
|
26 #include <hal.h> |
|
27 #include <errno.h> |
|
28 #include "te_regperformancelowmemoryteststep.h" |
|
29 |
|
30 CTe_RegPerformanceLowMemoryTestStep::~CTe_RegPerformanceLowMemoryTestStep() |
|
31 /** |
|
32 * Destructor |
|
33 */ |
|
34 { |
|
35 |
|
36 } |
|
37 |
|
38 CTe_RegPerformanceLowMemoryTestStep::CTe_RegPerformanceLowMemoryTestStep() |
|
39 /** |
|
40 * Constructor |
|
41 */ |
|
42 { |
|
43 // **MUST** call SetTestStepName in the constructor as the controlling |
|
44 // framework uses the test step name immediately following construction to set |
|
45 // up the step's unique logging ID. |
|
46 SetTestStepName(KTe_RegPerformanceLowMemoryTestStep); |
|
47 } |
|
48 |
|
49 TVerdict CTe_RegPerformanceLowMemoryTestStep::doTestStepPreambleL() |
|
50 /** |
|
51 * @return - TVerdict code |
|
52 * Override of base class virtual |
|
53 */ |
|
54 { |
|
55 SetTestStepResult(EPass); |
|
56 return TestStepResult(); |
|
57 } |
|
58 |
|
59 |
|
60 TVerdict CTe_RegPerformanceLowMemoryTestStep::doTestStepL() |
|
61 /** |
|
62 * @return - TVerdict code |
|
63 * Override of base class pure virtual |
|
64 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
65 * not leave. That being the case, the current test result value will be EPass. |
|
66 */ |
|
67 { |
|
68 TInt mallocSize = 5000; |
|
69 TInt reallocSize = 6000; |
|
70 INFO_PRINTF2(_L("Try to apply %D bytes memory!"), mallocSize); |
|
71 char* p = (char*) User::Alloc(mallocSize); |
|
72 if(p !=NULL ) |
|
73 { |
|
74 INFO_PRINTF2(_L("Apply %D bytes memory successful!"), mallocSize); |
|
75 p = (char*)User::ReAlloc(p, sizeof(char)*reallocSize); |
|
76 if(p!=NULL) |
|
77 { |
|
78 INFO_PRINTF2(_L("realloc %D bytes memory successful!"), reallocSize); |
|
79 } |
|
80 else |
|
81 { |
|
82 ERR_PRINTF2(_L("realloc %D bytes memory failed!"), reallocSize); |
|
83 } |
|
84 User::Free(p); |
|
85 } |
|
86 else |
|
87 { |
|
88 ERR_PRINTF2(_L("Apply %D bytes memory failed!"), mallocSize); |
|
89 } |
|
90 |
|
91 return TestStepResult(); |
|
92 } |
|
93 |
|
94 |
|
95 |
|
96 TVerdict CTe_RegPerformanceLowMemoryTestStep::doTestStepPostambleL() |
|
97 /** |
|
98 * @return - TVerdict code |
|
99 * Override of base class virtual |
|
100 */ |
|
101 { |
|
102 return TestStepResult(); |
|
103 } |