182 void Check1(TInt aValue, TInt aLine) |
182 void Check1(TInt aValue, TInt aLine) |
183 { |
183 { |
184 if(!aValue) |
184 if(!aValue) |
185 { |
185 { |
186 DeleteTestFiles(); |
186 DeleteTestFiles(); |
187 RDebug::Print(_L("*** Line %d\r\n"), aLine); |
187 TheTest.Printf(_L("*** Line %d. Expression evaluated to false\r\n"), aLine); |
188 TheTest(EFalse, aLine); |
188 TheTest(EFalse, aLine); |
189 } |
189 } |
190 } |
190 } |
191 void Check2(TInt aValue, TInt aExpected, TInt aLine) |
191 void Check2(TInt aValue, TInt aExpected, TInt aLine) |
192 { |
192 { |
193 if(aValue != aExpected) |
193 if(aValue != aExpected) |
194 { |
194 { |
195 DeleteTestFiles(); |
195 DeleteTestFiles(); |
196 RDebug::Print(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue); |
196 TheTest.Printf(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue); |
197 TheTest(EFalse, aLine); |
197 TheTest(EFalse, aLine); |
198 } |
198 } |
199 } |
199 } |
200 #define TEST(arg) ::Check1((arg), __LINE__) |
200 #define TEST(arg) ::Check1((arg), __LINE__) |
201 #define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__) |
201 #define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__) |
304 |
304 |
305 //////////////////// Executing the pragma and checking the results against the "ResultsTable" //////////// |
305 //////////////////// Executing the pragma and checking the results against the "ResultsTable" //////////// |
306 |
306 |
307 RSqlStatement stmt; |
307 RSqlStatement stmt; |
308 TInt err = stmt.Prepare(TheDb, TheSql); |
308 TInt err = stmt.Prepare(TheDb, TheSql); |
309 RDebug::Printf("Testing the following pragma command - %s",TheSql.Ptr()); |
309 TBuf<100> sqlBuf; |
|
310 sqlBuf.Copy(TheSql); |
|
311 sqlBuf.SetLength(sqlBuf.Length() - 1);//remove the terminating zero. |
|
312 TheTest.Printf(_L("Tested pragma command: %S\r\n"), &sqlBuf); |
310 switch (KResultsTable[i][index]) |
313 switch (KResultsTable[i][index]) |
311 { |
314 { |
312 case EOk: |
315 case EOk: |
313 case EIgnore: |
316 case EIgnore: |
314 TEST2(err, KErrNone); |
317 TEST2(err, KErrNone); |