sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef WIDECHARCLASSAPIBCTEST_H
|
sl@0
|
20 |
#define WIDECHARCLASSAPIBCTEST_H
|
sl@0
|
21 |
|
sl@0
|
22 |
// INCLUDES
|
sl@0
|
23 |
#include "StifTestModule.h"
|
sl@0
|
24 |
#include <StifLogger.h>
|
sl@0
|
25 |
#include <stl\_cwchar.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
// CONSTANTS
|
sl@0
|
28 |
//const ?type ?constant_var = ?constant;
|
sl@0
|
29 |
|
sl@0
|
30 |
// MACROS
|
sl@0
|
31 |
//#define ?macro ?macro_def
|
sl@0
|
32 |
#define TEST_MODULE_VERSION_MAJOR 50
|
sl@0
|
33 |
#define TEST_MODULE_VERSION_MINOR 9
|
sl@0
|
34 |
#define TEST_MODULE_VERSION_BUILD 06
|
sl@0
|
35 |
|
sl@0
|
36 |
// Logging path
|
sl@0
|
37 |
_LIT( KwidecharclassapiBCTestLogPath, "\\logs\\testframework\\widecharclassapiBCTest\\" );
|
sl@0
|
38 |
// Log file
|
sl@0
|
39 |
_LIT( KwidecharclassapiBCTestLogFile, "widecharclassapiBCTest.txt" );
|
sl@0
|
40 |
_LIT( KwidecharclassapiBCTestLogFileWithTitle, "widecharclassapiBCTest_[%S].txt" );
|
sl@0
|
41 |
|
sl@0
|
42 |
#define GETPTR &
|
sl@0
|
43 |
#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
|
sl@0
|
44 |
#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
|
sl@0
|
45 |
#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
|
sl@0
|
46 |
#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
|
sl@0
|
47 |
|
sl@0
|
48 |
// FUNCTION PROTOTYPES
|
sl@0
|
49 |
//?type ?function_name(?arg_list);
|
sl@0
|
50 |
|
sl@0
|
51 |
// FORWARD DECLARATIONS
|
sl@0
|
52 |
//class ?FORWARD_CLASSNAME;
|
sl@0
|
53 |
class CwidecharclassapiBCTest;
|
sl@0
|
54 |
|
sl@0
|
55 |
// DATA TYPES
|
sl@0
|
56 |
//enum ?declaration
|
sl@0
|
57 |
//typedef ?declaration
|
sl@0
|
58 |
//extern ?data_type;
|
sl@0
|
59 |
// A typedef for function that does the actual testing,
|
sl@0
|
60 |
// function is a type
|
sl@0
|
61 |
// TInt CwidecharclassapiBCTest::<NameOfFunction> ( TTestResult& aResult )
|
sl@0
|
62 |
typedef TInt (CwidecharclassapiBCTest::* TestFunction)(TTestResult&);
|
sl@0
|
63 |
|
sl@0
|
64 |
// CLASS DECLARATION
|
sl@0
|
65 |
|
sl@0
|
66 |
/**
|
sl@0
|
67 |
* An internal structure containing a test case name and
|
sl@0
|
68 |
* the pointer to function doing the test
|
sl@0
|
69 |
*
|
sl@0
|
70 |
* @lib ?library
|
sl@0
|
71 |
* @since ?Series60_version
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
class TCaseInfoInternal
|
sl@0
|
74 |
{
|
sl@0
|
75 |
public:
|
sl@0
|
76 |
const TText* iCaseName;
|
sl@0
|
77 |
TestFunction iMethod;
|
sl@0
|
78 |
TBool iIsOOMTest;
|
sl@0
|
79 |
TInt iFirstMemoryAllocation;
|
sl@0
|
80 |
TInt iLastMemoryAllocation;
|
sl@0
|
81 |
};
|
sl@0
|
82 |
|
sl@0
|
83 |
// CLASS DECLARATION
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* A structure containing a test case name and
|
sl@0
|
87 |
* the pointer to function doing the test
|
sl@0
|
88 |
*
|
sl@0
|
89 |
* @lib ?library
|
sl@0
|
90 |
* @since ?Series60_version
|
sl@0
|
91 |
*/
|
sl@0
|
92 |
class TCaseInfo
|
sl@0
|
93 |
{
|
sl@0
|
94 |
public:
|
sl@0
|
95 |
TPtrC iCaseName;
|
sl@0
|
96 |
TestFunction iMethod;
|
sl@0
|
97 |
TBool iIsOOMTest;
|
sl@0
|
98 |
TInt iFirstMemoryAllocation;
|
sl@0
|
99 |
TInt iLastMemoryAllocation;
|
sl@0
|
100 |
|
sl@0
|
101 |
TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
|
sl@0
|
102 |
{
|
sl@0
|
103 |
};
|
sl@0
|
104 |
|
sl@0
|
105 |
};
|
sl@0
|
106 |
|
sl@0
|
107 |
|
sl@0
|
108 |
// CLASS DECLARATION
|
sl@0
|
109 |
|
sl@0
|
110 |
/**
|
sl@0
|
111 |
* This a widecharclassapiBCTest class.
|
sl@0
|
112 |
* ?other_description_lines
|
sl@0
|
113 |
*
|
sl@0
|
114 |
* @lib ?library
|
sl@0
|
115 |
* @since ?Series60_version
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
NONSHARABLE_CLASS(CwidecharclassapiBCTest) : public CTestModuleBase
|
sl@0
|
118 |
{
|
sl@0
|
119 |
public: // Constructors and destructor
|
sl@0
|
120 |
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
* Two-phased constructor.
|
sl@0
|
124 |
*/
|
sl@0
|
125 |
static CwidecharclassapiBCTest* NewL();
|
sl@0
|
126 |
|
sl@0
|
127 |
/**
|
sl@0
|
128 |
* Destructor.
|
sl@0
|
129 |
*/
|
sl@0
|
130 |
virtual ~CwidecharclassapiBCTest();
|
sl@0
|
131 |
|
sl@0
|
132 |
public: // New functions
|
sl@0
|
133 |
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
* ?member_description.
|
sl@0
|
136 |
* @since ?Series60_version
|
sl@0
|
137 |
* @param ?arg1 ?description
|
sl@0
|
138 |
* @return ?description
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
//?type ?member_function( ?type ?arg1 );
|
sl@0
|
141 |
|
sl@0
|
142 |
public: // Functions from base classes
|
sl@0
|
143 |
|
sl@0
|
144 |
/**
|
sl@0
|
145 |
* From CTestModuleBase InitL is used to initialize the
|
sl@0
|
146 |
* widecharclassapiBCTest. It is called once for every instance of
|
sl@0
|
147 |
* TestModulewidecharclassapiBCTest after its creation.
|
sl@0
|
148 |
* @since ?Series60_version
|
sl@0
|
149 |
* @param aIniFile Initialization file for the test module (optional)
|
sl@0
|
150 |
* @param aFirstTime Flag is true when InitL is executed for first
|
sl@0
|
151 |
* created instance of widecharclassapiBCTest.
|
sl@0
|
152 |
* @return Symbian OS error code
|
sl@0
|
153 |
*/
|
sl@0
|
154 |
TInt InitL( TFileName& aIniFile, TBool aFirstTime );
|
sl@0
|
155 |
|
sl@0
|
156 |
/**
|
sl@0
|
157 |
* From CTestModuleBase GetTestCasesL is used to inquiry test cases
|
sl@0
|
158 |
* from widecharclassapiBCTest.
|
sl@0
|
159 |
* @since ?Series60_version
|
sl@0
|
160 |
* @param aTestCaseFile Test case file (optional)
|
sl@0
|
161 |
* @param aTestCases Array of TestCases returned to test framework
|
sl@0
|
162 |
* @return Symbian OS error code
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
TInt GetTestCasesL( const TFileName& aTestCaseFile,
|
sl@0
|
165 |
RPointerArray<TTestCaseInfo>& aTestCases );
|
sl@0
|
166 |
|
sl@0
|
167 |
/**
|
sl@0
|
168 |
* From CTestModuleBase RunTestCaseL is used to run an individual
|
sl@0
|
169 |
* test case.
|
sl@0
|
170 |
* @since ?Series60_version
|
sl@0
|
171 |
* @param aCaseNumber Test case number
|
sl@0
|
172 |
* @param aTestCaseFile Test case file (optional)
|
sl@0
|
173 |
* @param aResult Test case result returned to test framework (PASS/FAIL)
|
sl@0
|
174 |
* @return Symbian OS error code (test case execution error, which is
|
sl@0
|
175 |
* not reported in aResult parameter as test case failure).
|
sl@0
|
176 |
*/
|
sl@0
|
177 |
TInt RunTestCaseL( const TInt aCaseNumber,
|
sl@0
|
178 |
const TFileName& aTestCaseFile,
|
sl@0
|
179 |
TTestResult& aResult );
|
sl@0
|
180 |
|
sl@0
|
181 |
/**
|
sl@0
|
182 |
* From CTestModuleBase; OOMTestQueryL is used to specify is particular
|
sl@0
|
183 |
* test case going to be executed using OOM conditions
|
sl@0
|
184 |
* @param aTestCaseFile Test case file (optional)
|
sl@0
|
185 |
* @param aCaseNumber Test case number (optional)
|
sl@0
|
186 |
* @param aFailureType OOM failure type (optional)
|
sl@0
|
187 |
* @param aFirstMemFailure The first heap memory allocation failure value (optional)
|
sl@0
|
188 |
* @param aLastMemFailure The last heap memory allocation failure value (optional)
|
sl@0
|
189 |
* @return TBool
|
sl@0
|
190 |
*/
|
sl@0
|
191 |
virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */,
|
sl@0
|
192 |
const TInt /* aCaseNumber */,
|
sl@0
|
193 |
TOOMFailureType& aFailureType,
|
sl@0
|
194 |
TInt& /* aFirstMemFailure */,
|
sl@0
|
195 |
TInt& /* aLastMemFailure */ );
|
sl@0
|
196 |
|
sl@0
|
197 |
/**
|
sl@0
|
198 |
* From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
|
sl@0
|
199 |
* test environment
|
sl@0
|
200 |
* @param aTestCaseFile Test case file (optional)
|
sl@0
|
201 |
* @param aCaseNumber Test case number (optional)
|
sl@0
|
202 |
* @return None
|
sl@0
|
203 |
*/
|
sl@0
|
204 |
virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */,
|
sl@0
|
205 |
const TInt /* aCaseNumber */ );
|
sl@0
|
206 |
|
sl@0
|
207 |
/**
|
sl@0
|
208 |
* From CTestModuleBase; OOMHandleWarningL
|
sl@0
|
209 |
* @param aTestCaseFile Test case file (optional)
|
sl@0
|
210 |
* @param aCaseNumber Test case number (optional)
|
sl@0
|
211 |
* @param aFailNextValue FailNextValue for OOM test execution (optional)
|
sl@0
|
212 |
* @return None
|
sl@0
|
213 |
*
|
sl@0
|
214 |
* User may add implementation for OOM test warning handling. Usually no
|
sl@0
|
215 |
* implementation is required.
|
sl@0
|
216 |
*/
|
sl@0
|
217 |
virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
|
sl@0
|
218 |
const TInt /* aCaseNumber */,
|
sl@0
|
219 |
TInt& /* aFailNextValue */);
|
sl@0
|
220 |
|
sl@0
|
221 |
/**
|
sl@0
|
222 |
* From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
|
sl@0
|
223 |
* test environment
|
sl@0
|
224 |
* @param aTestCaseFile Test case file (optional)
|
sl@0
|
225 |
* @param aCaseNumber Test case number (optional)
|
sl@0
|
226 |
* @return None
|
sl@0
|
227 |
*
|
sl@0
|
228 |
*/
|
sl@0
|
229 |
virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */,
|
sl@0
|
230 |
const TInt /* aCaseNumber */ );
|
sl@0
|
231 |
|
sl@0
|
232 |
/**
|
sl@0
|
233 |
* Method used to log version of test module
|
sl@0
|
234 |
*/
|
sl@0
|
235 |
void SendTestModuleVersion();
|
sl@0
|
236 |
|
sl@0
|
237 |
protected: // New functions
|
sl@0
|
238 |
|
sl@0
|
239 |
/**
|
sl@0
|
240 |
* ?member_description.
|
sl@0
|
241 |
* @since ?Series60_version
|
sl@0
|
242 |
* @param ?arg1 ?description
|
sl@0
|
243 |
* @return ?description
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
//?type ?member_function( ?type ?arg1 );
|
sl@0
|
246 |
|
sl@0
|
247 |
protected: // Functions from base classes
|
sl@0
|
248 |
|
sl@0
|
249 |
/**
|
sl@0
|
250 |
* From ?base_class ?member_description
|
sl@0
|
251 |
*/
|
sl@0
|
252 |
//?type ?member_function();
|
sl@0
|
253 |
|
sl@0
|
254 |
private:
|
sl@0
|
255 |
|
sl@0
|
256 |
/**
|
sl@0
|
257 |
* C++ default constructor.
|
sl@0
|
258 |
*/
|
sl@0
|
259 |
CwidecharclassapiBCTest();
|
sl@0
|
260 |
|
sl@0
|
261 |
/**
|
sl@0
|
262 |
* By default Symbian 2nd phase constructor is private.
|
sl@0
|
263 |
*/
|
sl@0
|
264 |
void ConstructL();
|
sl@0
|
265 |
|
sl@0
|
266 |
// Prohibit copy constructor if not deriving from CBase.
|
sl@0
|
267 |
// ?classname( const ?classname& );
|
sl@0
|
268 |
// Prohibit assigment operator if not deriving from CBase.
|
sl@0
|
269 |
// ?classname& operator=( const ?classname& );
|
sl@0
|
270 |
|
sl@0
|
271 |
/**
|
sl@0
|
272 |
* Function returning test case name and pointer to test case function.
|
sl@0
|
273 |
* @since ?Series60_version
|
sl@0
|
274 |
* @param aCaseNumber test case number
|
sl@0
|
275 |
* @return TCaseInfo
|
sl@0
|
276 |
*/
|
sl@0
|
277 |
const TCaseInfo Case ( const TInt aCaseNumber ) const;
|
sl@0
|
278 |
|
sl@0
|
279 |
/**
|
sl@0
|
280 |
* [test case declarations] - do not remove
|
sl@0
|
281 |
*/
|
sl@0
|
282 |
//ADD NEW METHOD DEC HERE"
|
sl@0
|
283 |
|
sl@0
|
284 |
/**
|
sl@0
|
285 |
* Printing test case.
|
sl@0
|
286 |
* @since ?Series60_version
|
sl@0
|
287 |
* @param aResult Test case result (PASS/FAIL)
|
sl@0
|
288 |
* @return Symbian OS error code (test case execution error
|
sl@0
|
289 |
* that is not returned as test case result in aResult)
|
sl@0
|
290 |
*/
|
sl@0
|
291 |
TInt PrintTest( TTestResult& aResult );
|
sl@0
|
292 |
|
sl@0
|
293 |
/**
|
sl@0
|
294 |
* Printing loop test case.
|
sl@0
|
295 |
* @since ?Series60_version
|
sl@0
|
296 |
* @param aResult Test case result (PASS/FAIL)
|
sl@0
|
297 |
* @return Symbian OS error code (test case execution error
|
sl@0
|
298 |
* that is not returned as test case result in aResult)
|
sl@0
|
299 |
*/
|
sl@0
|
300 |
TInt LoopTest( TTestResult& aResult );
|
sl@0
|
301 |
|
sl@0
|
302 |
TInt ArithmeticTest( TTestResult& aResult );
|
sl@0
|
303 |
TInt FileManipulationTest( TTestResult& aResult );
|
sl@0
|
304 |
TInt ConsoleOperationsTest( TTestResult& aResult );
|
sl@0
|
305 |
TInt StringOperationsTest( TTestResult& aResult );
|
sl@0
|
306 |
TInt ConversionOperationsTest( TTestResult& aResult );
|
sl@0
|
307 |
|
sl@0
|
308 |
public: // Data
|
sl@0
|
309 |
// ?one_line_short_description_of_data
|
sl@0
|
310 |
//?data_declaration;
|
sl@0
|
311 |
|
sl@0
|
312 |
protected: // Data
|
sl@0
|
313 |
// ?one_line_short_description_of_data
|
sl@0
|
314 |
//?data_declaration;
|
sl@0
|
315 |
|
sl@0
|
316 |
private: // Data
|
sl@0
|
317 |
// Pointer to test (function) to be executed
|
sl@0
|
318 |
TestFunction iMethod;
|
sl@0
|
319 |
|
sl@0
|
320 |
// Pointer to logger
|
sl@0
|
321 |
CStifLogger * iLog;
|
sl@0
|
322 |
|
sl@0
|
323 |
// Normal logger
|
sl@0
|
324 |
CStifLogger* iStdLog;
|
sl@0
|
325 |
|
sl@0
|
326 |
// Test case logger
|
sl@0
|
327 |
CStifLogger* iTCLog;
|
sl@0
|
328 |
|
sl@0
|
329 |
// Flag saying if test case title should be added to log file name
|
sl@0
|
330 |
TBool iAddTestCaseTitleToLogName;
|
sl@0
|
331 |
|
sl@0
|
332 |
// Flag saying if version of test module was already sent
|
sl@0
|
333 |
TBool iVersionLogged;
|
sl@0
|
334 |
|
sl@0
|
335 |
// ?one_line_short_description_of_data
|
sl@0
|
336 |
//?data_declaration;
|
sl@0
|
337 |
|
sl@0
|
338 |
// Reserved pointer for future extension
|
sl@0
|
339 |
//TAny* iReserved;
|
sl@0
|
340 |
|
sl@0
|
341 |
public: // Friend classes
|
sl@0
|
342 |
//?friend_class_declaration;
|
sl@0
|
343 |
protected: // Friend classes
|
sl@0
|
344 |
//?friend_class_declaration;
|
sl@0
|
345 |
private: // Friend classes
|
sl@0
|
346 |
//?friend_class_declaration;
|
sl@0
|
347 |
|
sl@0
|
348 |
};
|
sl@0
|
349 |
|
sl@0
|
350 |
#endif // WIDECHARCLASSAPIBCTEST_H
|
sl@0
|
351 |
|
sl@0
|
352 |
// End of File
|