63 void Check(TInt aValue, TInt aLine) |
63 void Check(TInt aValue, TInt aLine) |
64 { |
64 { |
65 if(!aValue) |
65 if(!aValue) |
66 { |
66 { |
67 DestroyTestEnv(); |
67 DestroyTestEnv(); |
68 RDebug::Print(_L("*** Expresssion evaluated to false\r\n")); |
68 TheTest.Printf(_L("*** Expresssion evaluated to false\r\n")); |
69 TheTest(EFalse, aLine); |
69 TheTest(EFalse, aLine); |
70 } |
70 } |
71 } |
71 } |
72 void Check(TInt aValue, TInt aExpected, TInt aLine) |
72 void Check(TInt aValue, TInt aExpected, TInt aLine) |
73 { |
73 { |
74 if(aValue != aExpected) |
74 if(aValue != aExpected) |
75 { |
75 { |
76 DestroyTestEnv(); |
76 DestroyTestEnv(); |
77 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
77 TheTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
78 TheTest(EFalse, aLine); |
78 TheTest(EFalse, aLine); |
79 } |
79 } |
80 } |
80 } |
81 #define TEST(arg) ::Check((arg), __LINE__) |
81 #define TEST(arg) ::Check((arg), __LINE__) |
82 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
82 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
197 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
197 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
198 |
198 |
199 TInt err = TheDb.Open(KDbFile); |
199 TInt err = TheDb.Open(KDbFile); |
200 TEST2(err, KErrNone); |
200 TEST2(err, KErrNone); |
201 |
201 |
|
202 TPtrC name; |
202 TInt failingAllocationNo = 0; |
203 TInt failingAllocationNo = 0; |
203 err = KErrNoMemory; |
204 err = KErrNoMemory; |
204 while(err == KErrNoMemory) |
205 while(err == KErrNoMemory) |
205 { |
206 { |
206 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
207 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
280 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
280 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
281 |
281 |
282 TInt err = TheDb.Open(KDbFile); |
282 TInt err = TheDb.Open(KDbFile); |
283 TEST2(err, KErrNone); |
283 TEST2(err, KErrNone); |
284 |
284 |
|
285 TPtrC name; |
285 TInt failingAllocationNo = 0; |
286 TInt failingAllocationNo = 0; |
286 err = KErrNoMemory; |
287 err = KErrNoMemory; |
287 while(err == KErrNoMemory) |
288 while(err == KErrNoMemory) |
288 { |
289 { |
289 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
290 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
363 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
363 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
364 |
364 |
365 TInt err = TheDb.Open(KDbFile); |
365 TInt err = TheDb.Open(KDbFile); |
366 TEST2(err, KErrNone); |
366 TEST2(err, KErrNone); |
367 |
367 |
|
368 TPtrC data; |
368 TInt failingAllocationNo = 0; |
369 TInt failingAllocationNo = 0; |
369 err = KErrNoMemory; |
370 err = KErrNoMemory; |
370 while(err == KErrNoMemory) |
371 while(err == KErrNoMemory) |
371 { |
372 { |
372 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
373 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
451 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
451 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
452 |
452 |
453 TInt err = TheDb.Open(KDbFile); |
453 TInt err = TheDb.Open(KDbFile); |
454 TEST2(err, KErrNone); |
454 TEST2(err, KErrNone); |
455 |
455 |
|
456 TBuf<50> data; |
|
457 RSqlColumnReadStream strm; |
456 TInt failingAllocationNo = 0; |
458 TInt failingAllocationNo = 0; |
457 err = KErrNoMemory; |
459 err = KErrNoMemory; |
|
460 TInt len = -1; |
458 while(err == KErrNoMemory) |
461 while(err == KErrNoMemory) |
459 { |
462 { |
460 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
463 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
461 OomPreStep(failingAllocationNo); |
464 OomPreStep(failingAllocationNo); |
462 |
465 |
634 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
634 CreateTestDb(KDbFile);//Creates UTF8 encoded database with one table with one record. |
635 |
635 |
636 TInt err = TheDb.Open(KDbFile); |
636 TInt err = TheDb.Open(KDbFile); |
637 TEST2(err, KErrNone); |
637 TEST2(err, KErrNone); |
638 |
638 |
|
639 TSqlColumnType colType = ESqlNull; |
639 TInt failingAllocationNo = 0; |
640 TInt failingAllocationNo = 0; |
640 err = KErrNoMemory; |
641 err = KErrNoMemory; |
641 while(err == KErrNoMemory) |
642 while(err == KErrNoMemory) |
642 { |
643 { |
643 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |
644 TheTest.Printf(_L(" %d"), ++failingAllocationNo); |