|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 #ifndef t_logutil_h |
|
16 #define t_logutil_h |
|
17 |
|
18 #include <e32test.h> |
|
19 |
|
20 //Define "TheTest" variable in the cpp test file |
|
21 extern RTest TheTest; |
|
22 |
|
23 void LogTestBoolExpr(TBool aRes, const TText* aFile, TInt aLine, TBool aPrintThreadName = EFalse); |
|
24 void LogCheck(TInt aValue, TInt aExpected, const TText* aFile, TInt aLine, TBool aPrintThreadName = EFalse); |
|
25 void LogCheckU(TUint aValue, TUint aExpected, const TText* aFile, TInt aLine, TBool aPrintThreadName = EFalse); |
|
26 |
|
27 #define TEST_STRING(s) _S(s) |
|
28 |
|
29 #define TEST(arg) LogTestBoolExpr((arg), TEST_STRING(__FILE__), __LINE__) |
|
30 #define TEST2(aValue, aExpected) LogCheck((aValue), (aExpected), TEST_STRING(__FILE__), __LINE__) |
|
31 #define TEST2U(aValue, aExpected) LogCheckU((aValue), (aExpected), TEST_STRING(__FILE__), __LINE__) |
|
32 |
|
33 #define TTEST(arg) LogTestBoolExpr((arg), TEST_STRING(__FILE__), __LINE__, ETrue) |
|
34 #define TTEST2(aValue, aExpected) LogCheck((aValue), (aExpected), TEST_STRING(__FILE__), __LINE__, ETrue) |
|
35 #define TTEST2U(aValue, aExpected) LogCheckU((aValue), (aExpected), TEST_STRING(__FILE__), __LINE__, ETrue) |
|
36 |
|
37 void LogLeave(TInt aErr, const TText* aFile, TInt aLine); |
|
38 |
|
39 #define LEAVE(err) LogLeave(err, TEST_STRING(__FILE__), __LINE__) |
|
40 #define LEAVE_IF_ERROR(err) do {if(err < KErrNone) LogLeave(err, TEST_STRING(__FILE__), __LINE__);} while(0) |
|
41 |
|
42 |
|
43 void LogPanic(const TDesC& aCategory, TInt aErr, const TText* aFile, TInt aLine); |
|
44 |
|
45 #define PANIC(cat, err) LogPanic(cat, err, TEST_STRING(__FILE__), __LINE__) |
|
46 |
|
47 TPtrC FileName(const TText* aFile); |
|
48 TInt KillProcess(const TDesC& aProcessName); |
|
49 |
|
50 #endif//t_logutil_h |