|
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 |
|
16 #ifndef __T_RTEST_PANIC_H_INCLUDED__ |
|
17 #define __T_RTEST_PANIC_H_INCLUDED__ |
|
18 |
|
19 #define __E32TEST_EXTENSION__ |
|
20 |
|
21 #include <e32test.h> |
|
22 |
|
23 #ifdef USE_RTEST_MACROS |
|
24 |
|
25 #define TEST_FAILED() { User::Panic(_L("USER"),84); } |
|
26 #define TEST_EQUAL(e, a) test_Equal(e, a) |
|
27 #define TEST_COMPARE(a,b,c) test_Compare(a,b,c) |
|
28 #define TEST_KErrNone(x) test_KErrNone(x) |
|
29 #define TEST(x) test(x) |
|
30 |
|
31 #else |
|
32 |
|
33 static TPtrC GetCurrentSourceFileName(const TText* aFilePath) |
|
34 { |
|
35 TPtrC filePath(aFilePath); |
|
36 TInt pos = filePath.LocateReverse('\\'); |
|
37 if (pos < 0) |
|
38 { |
|
39 pos = filePath.LocateReverse('/'); |
|
40 } |
|
41 TPtrC fileName; |
|
42 if (pos < 0) |
|
43 { |
|
44 fileName.Set(filePath); |
|
45 } |
|
46 else |
|
47 { |
|
48 fileName.Set(filePath.Right(filePath.Length() - pos - 1)); |
|
49 } |
|
50 return fileName; |
|
51 } |
|
52 |
|
53 #define TEST_FAILED() { User::Panic(GetCurrentSourceFileName(__S(__FILE__)),__LINE__); } |
|
54 #define TEST_EQUAL(e, a) { TInt _e = TInt(e); TInt _a = TInt(a); if (_e != _a) TEST_FAILED(); } |
|
55 #define TEST_COMPARE(a,b,c) { TInt _a = TInt(a); TInt _c = TInt(c); if (!(_a b _c)) TEST_FAILED(); } |
|
56 #define TEST_KErrNone(x) { TInt _r = (x); if (_r !=KErrNone) TEST_FAILED(); } |
|
57 #define TEST(x) { if (!(x)) TEST_FAILED(); } |
|
58 |
|
59 #endif // USE_RTEST_MACROS |
|
60 |
|
61 #endif // __T_RTEST_PANIC_H_INCLUDED__ |