72
|
1 |
//
|
|
2 |
// Copyright (c) 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 |
//
|
|
16 |
//
|
|
17 |
//
|
|
18 |
// This contains CommDb Unit Test Case 001.01
|
|
19 |
|
|
20 |
// EPOC includes
|
|
21 |
#include <e32base.h>
|
|
22 |
|
|
23 |
// Test system includes
|
|
24 |
#include "Teststepcommdb.h"
|
|
25 |
#include "step_001_01.h"
|
|
26 |
|
|
27 |
#include <commdb.h>
|
|
28 |
|
|
29 |
// constructor
|
|
30 |
CCommDbTest001_01::CCommDbTest001_01()
|
|
31 |
{
|
|
32 |
// store the name of this test case
|
|
33 |
SetTestStepName(_L("step_001_01"));
|
|
34 |
}
|
|
35 |
|
|
36 |
// destructor
|
|
37 |
CCommDbTest001_01::~CCommDbTest001_01()
|
|
38 |
{
|
|
39 |
}
|
|
40 |
|
|
41 |
TVerdict CCommDbTest001_01::doTestStepPreambleL()
|
|
42 |
{
|
|
43 |
SetTestStepResult(EPass); return TestStepResult();
|
|
44 |
}
|
|
45 |
|
|
46 |
TInt CCommDbTest001_01::executeStepL()
|
|
47 |
{
|
|
48 |
CCommsDatabase* TheDb = NULL;
|
|
49 |
TRAPD( err, TheDb=CCommsDatabase::NewL() );
|
|
50 |
delete TheDb;
|
|
51 |
return err;
|
|
52 |
}
|
|
53 |
|
|
54 |
// do Test step 001.01
|
|
55 |
TVerdict CCommDbTest001_01::doTestStepL( )
|
|
56 |
{
|
|
57 |
TInt res;
|
|
58 |
INFO_PRINTF1(_L("Step 001.01 called "));
|
|
59 |
res = executeStepL();
|
|
60 |
if (res == KErrNone)
|
|
61 |
{
|
|
62 |
SetTestStepResult(EPass); }
|
|
63 |
else
|
|
64 |
{
|
|
65 |
INFO_PRINTF2(_L("Step 001.01 failed with error: %d"),res);
|
|
66 |
SetTestStepResult(EFail); }
|
|
67 |
|
|
68 |
return TestStepResult();
|
|
69 |
}
|
|
70 |
|
|
71 |
// constructor
|
|
72 |
CCommDbTest001_03::CCommDbTest001_03()
|
|
73 |
{
|
|
74 |
// store the name of this test case
|
|
75 |
SetTestStepName(_L("step_001_03"));
|
|
76 |
}
|
|
77 |
|
|
78 |
// destructor
|
|
79 |
CCommDbTest001_03::~CCommDbTest001_03()
|
|
80 |
{
|
|
81 |
}
|
|
82 |
|
|
83 |
TInt CCommDbTest001_03::executeStepL()
|
|
84 |
{
|
|
85 |
TInt ret = KErrNone;
|
|
86 |
|
|
87 |
CCommsDatabase* TheDb = NULL;
|
|
88 |
TRAPD( err, TheDb=CCommsDatabase::NewL() );
|
|
89 |
if (err != KErrNone)
|
|
90 |
ret = err;
|
|
91 |
|
|
92 |
delete TheDb;
|
|
93 |
return ret;
|
|
94 |
}
|
|
95 |
|
|
96 |
// do Test step 001.03
|
|
97 |
TVerdict CCommDbTest001_03::doTestStepL( )
|
|
98 |
{
|
|
99 |
|
|
100 |
INFO_PRINTF1(_L("Step 001.03 called "));
|
|
101 |
|
|
102 |
if (executeStepL() == KErrNone)
|
|
103 |
SetTestStepResult(EPass); else
|
|
104 |
SetTestStepResult(EFail);
|
|
105 |
return TestStepResult();
|
|
106 |
}
|
|
107 |
|
|
108 |
// constructor
|
|
109 |
CCommDbTest001_04::CCommDbTest001_04()
|
|
110 |
{
|
|
111 |
// store the name of this test case
|
|
112 |
SetTestStepName(_L("step_001_04"));
|
|
113 |
}
|
|
114 |
|
|
115 |
// destructor
|
|
116 |
CCommDbTest001_04::~CCommDbTest001_04()
|
|
117 |
{
|
|
118 |
}
|
|
119 |
|
|
120 |
TVerdict CCommDbTest001_04::doTestStepPreambleL()
|
|
121 |
{
|
|
122 |
SetTestStepResult(EPass); return TestStepResult();
|
|
123 |
}
|
|
124 |
|
|
125 |
TInt CCommDbTest001_04::executeStepL()
|
|
126 |
{
|
|
127 |
CCommsDatabase* TheDb = NULL;
|
|
128 |
TRAPD( err, TheDb=CCommsDatabase::NewL() );
|
|
129 |
|
|
130 |
delete TheDb;
|
|
131 |
|
|
132 |
return err;
|
|
133 |
}
|
|
134 |
|
|
135 |
// do Test step 001.04
|
|
136 |
TVerdict CCommDbTest001_04::doTestStepL( )
|
|
137 |
{
|
|
138 |
|
|
139 |
INFO_PRINTF1(_L("Step 001.04 called "));
|
|
140 |
if (executeStepL() == KErrNone)
|
|
141 |
SetTestStepResult(EPass); else
|
|
142 |
SetTestStepResult(EFail);
|
|
143 |
|
|
144 |
return TestStepResult();
|
|
145 |
}
|
|
146 |
|
|
147 |
// constructor
|
|
148 |
CCommDbTest001_05::CCommDbTest001_05()
|
|
149 |
{
|
|
150 |
// store the name of this test case
|
|
151 |
SetTestStepName(_L("step_001_05"));
|
|
152 |
}
|
|
153 |
|
|
154 |
// destructor
|
|
155 |
CCommDbTest001_05::~CCommDbTest001_05()
|
|
156 |
{
|
|
157 |
}
|
|
158 |
|
|
159 |
TVerdict CCommDbTest001_05::doTestStepPreambleL()
|
|
160 |
{
|
|
161 |
// delete database file before running this test
|
|
162 |
SetTestStepResult(EPass); return TestStepResult();
|
|
163 |
}
|
|
164 |
|
|
165 |
TInt CCommDbTest001_05::executeStepL()
|
|
166 |
{
|
|
167 |
TInt ret = KErrGeneral;
|
|
168 |
|
|
169 |
CCommsDatabase* TheDb;
|
|
170 |
TCommDbOpeningMethod openingMethod;
|
|
171 |
TheDb=CCommsDatabase::NewL(openingMethod);
|
|
172 |
|
|
173 |
if ( openingMethod == ECommDbOpened )
|
|
174 |
ret = KErrNone;
|
|
175 |
|
|
176 |
delete TheDb;
|
|
177 |
|
|
178 |
return ret;
|
|
179 |
}
|
|
180 |
|
|
181 |
// do Test step 001.05
|
|
182 |
TVerdict CCommDbTest001_05::doTestStepL( )
|
|
183 |
{
|
|
184 |
|
|
185 |
INFO_PRINTF1(_L("Step 001.05 called "));
|
|
186 |
|
|
187 |
if (executeStepL() == KErrNone)
|
|
188 |
SetTestStepResult(EPass); else
|
|
189 |
SetTestStepResult(EFail);
|
|
190 |
return TestStepResult();
|
|
191 |
}
|
|
192 |
|
|
193 |
// constructor
|
|
194 |
CCommDbTest001_07::CCommDbTest001_07()
|
|
195 |
{
|
|
196 |
// store the name of this test case
|
|
197 |
SetTestStepName(_L("step_001_07"));
|
|
198 |
}
|
|
199 |
|
|
200 |
// destructor
|
|
201 |
CCommDbTest001_07::~CCommDbTest001_07()
|
|
202 |
{
|
|
203 |
}
|
|
204 |
|
|
205 |
TInt CCommDbTest001_07::executeStepL()
|
|
206 |
{
|
|
207 |
// make sure database exists before running this test
|
|
208 |
TInt ret = KErrGeneral;
|
|
209 |
|
|
210 |
copyTestDatabase( EDatabase_1 );
|
|
211 |
|
|
212 |
CCommsDatabase* TheDb;
|
|
213 |
TCommDbOpeningMethod openingMethod;
|
|
214 |
TheDb=CCommsDatabase::NewL(openingMethod);
|
|
215 |
|
|
216 |
if ( openingMethod == ECommDbOpened )
|
|
217 |
ret = KErrNone;
|
|
218 |
|
|
219 |
delete TheDb;
|
|
220 |
|
|
221 |
return ret;
|
|
222 |
}
|
|
223 |
|
|
224 |
// do Test step 001.07
|
|
225 |
TVerdict CCommDbTest001_07::doTestStepL( )
|
|
226 |
{
|
|
227 |
|
|
228 |
INFO_PRINTF1(_L("Step 001.07 called "));
|
|
229 |
|
|
230 |
if (executeStepL() == KErrNone)
|
|
231 |
SetTestStepResult(EPass); else
|
|
232 |
SetTestStepResult(EFail);
|
|
233 |
return TestStepResult();
|
|
234 |
}
|
|
235 |
|
|
236 |
// constructor
|
|
237 |
CCommDbTest001_08::CCommDbTest001_08()
|
|
238 |
{
|
|
239 |
// store the name of this test case
|
|
240 |
SetTestStepName(_L("step_001_08"));
|
|
241 |
}
|
|
242 |
|
|
243 |
// destructor
|
|
244 |
CCommDbTest001_08::~CCommDbTest001_08()
|
|
245 |
{
|
|
246 |
}
|
|
247 |
|
|
248 |
TInt CCommDbTest001_08::executeStepL()
|
|
249 |
{
|
|
250 |
TInt ret = KErrNone;
|
|
251 |
|
|
252 |
CCommsDatabase* TheDb = NULL;
|
|
253 |
TRAPD( err, TheDb=CCommsDatabase::NewL(EFalse) );
|
|
254 |
if (err != KErrNone)
|
|
255 |
ret = err;
|
|
256 |
|
|
257 |
// if we get here, test was successful
|
|
258 |
delete TheDb;
|
|
259 |
|
|
260 |
return ret;
|
|
261 |
}
|
|
262 |
|
|
263 |
// do Test step 001.08
|
|
264 |
TVerdict CCommDbTest001_08::doTestStepL( )
|
|
265 |
{
|
|
266 |
|
|
267 |
INFO_PRINTF1(_L("Step 001.08 called "));
|
|
268 |
|
|
269 |
if (executeStepL() == KErrNone)
|
|
270 |
SetTestStepResult(EPass); else
|
|
271 |
SetTestStepResult(EFail);
|
|
272 |
return TestStepResult();
|
|
273 |
}
|
|
274 |
|
|
275 |
// constructor
|
|
276 |
CCommDbTest001_09::CCommDbTest001_09()
|
|
277 |
{
|
|
278 |
// store the name of this test case
|
|
279 |
SetTestStepName(_L("step_001_09"));
|
|
280 |
}
|
|
281 |
|
|
282 |
// destructor
|
|
283 |
CCommDbTest001_09::~CCommDbTest001_09()
|
|
284 |
{
|
|
285 |
}
|
|
286 |
|
|
287 |
TInt CCommDbTest001_09::executeStepL()
|
|
288 |
{
|
|
289 |
TInt ret = KErrNone;
|
|
290 |
|
|
291 |
CCommsDatabase* TheDb = NULL;
|
|
292 |
TRAPD( err, TheDb=CCommsDatabase::NewL(ETrue) );
|
|
293 |
if (err != KErrNone)
|
|
294 |
ret = err;
|
|
295 |
|
|
296 |
// if we get here, test was successful
|
|
297 |
delete TheDb;
|
|
298 |
|
|
299 |
return ret;
|
|
300 |
}
|
|
301 |
|
|
302 |
// do Test step 001.09
|
|
303 |
TVerdict CCommDbTest001_09::doTestStepL( )
|
|
304 |
{
|
|
305 |
|
|
306 |
INFO_PRINTF1(_L("Step 001.09 called "));
|
|
307 |
|
|
308 |
if (executeStepL() == KErrNone)
|
|
309 |
SetTestStepResult(EPass); else
|
|
310 |
SetTestStepResult(EFail);
|
|
311 |
return TestStepResult();
|
|
312 |
}
|
|
313 |
|
|
314 |
// constructor
|
|
315 |
CCommDbTest001_10::CCommDbTest001_10()
|
|
316 |
{
|
|
317 |
// store the name of this test case
|
|
318 |
SetTestStepName(_L("step_001_10"));
|
|
319 |
}
|
|
320 |
|
|
321 |
// destructor
|
|
322 |
CCommDbTest001_10::~CCommDbTest001_10()
|
|
323 |
{
|
|
324 |
}
|
|
325 |
|
|
326 |
// do Test step 001.10
|
|
327 |
TVerdict CCommDbTest001_10::doTestStepL( )
|
|
328 |
{
|
|
329 |
|
|
330 |
INFO_PRINTF1(_L("Step 001.10 called "));
|
|
331 |
|
|
332 |
SetTestStepResult(EPass);
|
|
333 |
//Heap test for 001.01
|
|
334 |
|
|
335 |
CCommDbTest001_01* step001_01 = new CCommDbTest001_01;
|
|
336 |
CleanupStack::PushL(step001_01);
|
|
337 |
doTestStepWithHeapFailureL( *step001_01, KErrNone);
|
|
338 |
if( step001_01->TestStepResult() == EFail )
|
|
339 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_01);
|
|
340 |
|
|
341 |
//Heap test for 001.03
|
|
342 |
|
|
343 |
CCommDbTest001_03* step001_03 = new CCommDbTest001_03;
|
|
344 |
CleanupStack::PushL(step001_03);
|
|
345 |
doTestStepWithHeapFailureL( *step001_03, KErrNone);
|
|
346 |
if( step001_03->TestStepResult() == EFail )
|
|
347 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_03);
|
|
348 |
|
|
349 |
//Heap test for 001.04
|
|
350 |
|
|
351 |
CCommDbTest001_04* step001_04 = new CCommDbTest001_04;
|
|
352 |
CleanupStack::PushL(step001_04);
|
|
353 |
doTestStepWithHeapFailureL( *step001_04, KErrNone);
|
|
354 |
if( step001_04->TestStepResult() == EFail )
|
|
355 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_04);
|
|
356 |
|
|
357 |
//Heap test for 001.05
|
|
358 |
|
|
359 |
CCommDbTest001_05* step001_05 = new CCommDbTest001_05;
|
|
360 |
CleanupStack::PushL(step001_05);
|
|
361 |
doTestStepWithHeapFailureL( *step001_05, KErrNone);
|
|
362 |
if( step001_05->TestStepResult() == EFail )
|
|
363 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_05);
|
|
364 |
|
|
365 |
//Heap test for 001.07
|
|
366 |
|
|
367 |
CCommDbTest001_07* step001_07 = new CCommDbTest001_07;
|
|
368 |
CleanupStack::PushL(step001_07);
|
|
369 |
doTestStepWithHeapFailureL( *step001_07, KErrNone);
|
|
370 |
if( step001_07->TestStepResult() == EFail )
|
|
371 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_07);
|
|
372 |
|
|
373 |
//Heap test for 001.08
|
|
374 |
|
|
375 |
CCommDbTest001_08* step001_08 = new CCommDbTest001_08;
|
|
376 |
CleanupStack::PushL(step001_08);
|
|
377 |
doTestStepWithHeapFailureL( *step001_08, KErrNone);
|
|
378 |
if( step001_08->TestStepResult() == EFail )
|
|
379 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_08);
|
|
380 |
|
|
381 |
//Heap test for 001.09
|
|
382 |
|
|
383 |
CCommDbTest001_09* step001_09 = new CCommDbTest001_09;
|
|
384 |
CleanupStack::PushL(step001_09);
|
|
385 |
doTestStepWithHeapFailureL( *step001_09, KErrNone);
|
|
386 |
if( step001_09->TestStepResult() == EFail )
|
|
387 |
SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step001_09);
|
|
388 |
|
|
389 |
return TestStepResult();
|
|
390 |
}
|