73 void Check(TInt aValue, TInt aLine) |
73 void Check(TInt aValue, TInt aLine) |
74 { |
74 { |
75 if(!aValue) |
75 if(!aValue) |
76 { |
76 { |
77 DestroyTestEnv(); |
77 DestroyTestEnv(); |
|
78 TheTest.Printf(_L("*** Expression evaluated to false\r\n")); |
78 TheTest(EFalse, aLine); |
79 TheTest(EFalse, aLine); |
79 } |
80 } |
80 } |
81 } |
81 void Check(TInt aValue, TInt aExpected, TInt aLine) |
82 void Check(TInt aValue, TInt aExpected, TInt aLine) |
82 { |
83 { |
83 if(aValue != aExpected) |
84 if(aValue != aExpected) |
84 { |
85 { |
85 DestroyTestEnv(); |
86 DestroyTestEnv(); |
86 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
87 TheTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
87 TheTest(EFalse, aLine); |
88 TheTest(EFalse, aLine); |
88 } |
89 } |
89 } |
90 } |
90 #define TEST(arg) ::Check((arg), __LINE__) |
91 #define TEST(arg) ::Check((arg), __LINE__) |
91 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
92 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
92 |
93 |
93 void SqliteCheck(sqlite3* aDbHandle, TInt aValue, TInt aExpected, TInt aLine) |
94 void SqliteCheck(sqlite3* aDbHandle, TInt aValue, TInt aExpected, TInt aLine) |
94 { |
95 { |
95 if(aValue != aExpected) |
96 if(aValue != aExpected) |
96 { |
97 { |
97 RDebug::Print(_L("*** SQLITE: Expected error: %d, got: %d\r\n"), aExpected, aValue); |
98 TheTest.Printf(_L("*** SQLITE: Expected error: %d, got: %d\r\n"), aExpected, aValue); |
98 if(aDbHandle) |
99 if(aDbHandle) |
99 { |
100 { |
100 const char* errMsg = sqlite3_errmsg(aDbHandle); |
101 const char* errMsg = sqlite3_errmsg(aDbHandle); |
101 TPtrC8 ptr8((const TUint8*)errMsg, strlen(errMsg)); |
102 TPtrC8 ptr8((const TUint8*)errMsg, strlen(errMsg)); |
102 TBuf<200> buf; |
103 TBuf<200> buf; |
103 buf.Copy(ptr8); |
104 buf.Copy(ptr8); |
104 RDebug::Print(_L("*** SQLITE error message: \"%S\"\r\n"), &buf); |
105 TheTest.Printf(_L("*** SQLITE error message: \"%S\"\r\n"), &buf); |
105 } |
106 } |
106 DestroyTestEnv(); |
107 DestroyTestEnv(); |
107 TheTest(EFalse, aLine); |
108 TheTest(EFalse, aLine); |
108 } |
109 } |
109 } |
110 } |