1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
47 static void Panic(TInt aLine, TInt aPanicCode) |
47 static void Panic(TInt aLine, TInt aPanicCode) |
48 { |
48 { |
49 TBuf<64> buf; |
49 TBuf<64> buf; |
50 _LIT(KFormat,"*** Panic %d, at line t_sqlitewsd2.cpp(%d)\r\n"); |
50 _LIT(KFormat,"*** Panic %d, at line t_sqlitewsd2.cpp(%d)\r\n"); |
51 buf.Format(KFormat, aPanicCode, aLine); |
51 buf.Format(KFormat, aPanicCode, aLine); |
52 RDebug::Print(buf); |
52 TheTest.Printf(buf); |
53 User::Panic(KPanicCategory, aPanicCode); |
53 User::Panic(KPanicCategory, aPanicCode); |
54 } |
54 } |
55 |
55 |
56 //Test macros and functions |
56 //Test macros and functions |
57 void Check(TInt aValue, TInt aLine) |
57 void Check(TInt aValue, TInt aLine) |
58 { |
58 { |
59 if(!aValue) |
59 if(!aValue) |
60 { |
60 { |
61 DestroyTestEnv(); |
61 DestroyTestEnv(); |
62 RDebug::Print(_L("*** Expression evaluates to false.\r\n")); |
62 TheTest.Printf(_L("*** Expression evaluated to false.\r\n")); |
63 Panic(aLine, KExprEvalFailed1); |
63 Panic(aLine, KExprEvalFailed1); |
64 } |
64 } |
65 } |
65 } |
66 |
66 |
67 void Check(TInt aValue, TInt aExpected, TInt aLine) |
67 void Check(TInt aValue, TInt aExpected, TInt aLine) |
68 { |
68 { |
69 if(aValue != aExpected) |
69 if(aValue != aExpected) |
70 { |
70 { |
71 RDebug::Print(_L("*** Expected error: %d, got: %d.\r\n"), aExpected, aValue); |
71 TheTest.Printf(_L("*** Expected error: %d, got: %d.\r\n"), aExpected, aValue); |
72 const char* errMsg = sqlite3_errmsg(TheDb); |
72 const char* errMsg = sqlite3_errmsg(TheDb); |
73 if(errMsg) |
73 if(errMsg) |
74 { |
74 { |
75 TBuf<200> msgBuf; |
75 TBuf<200> msgBuf; |
76 msgBuf.Copy(TPtrC8((const TUint8*)errMsg)); |
76 msgBuf.Copy(TPtrC8((const TUint8*)errMsg)); |
77 RDebug::Print(_L("*** SQLITE error msg: \"%S\".\r\n"), &msgBuf); |
77 TheTest.Printf(_L("*** SQLITE error msg: \"%S\".\r\n"), &msgBuf); |
78 } |
78 } |
79 DestroyTestEnv(); |
79 DestroyTestEnv(); |
80 Panic(aLine, KExprEvalFailed2); |
80 Panic(aLine, KExprEvalFailed2); |
81 } |
81 } |
82 } |
82 } |