|
1 // Copyright (c) 2002-2009 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 the License "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 // Global configuration for the tests |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef UTL_H |
|
19 #define UTL_H |
|
20 |
|
21 #include <e32test.h> |
|
22 |
|
23 GLREF_D RTest test; |
|
24 |
|
25 #define TEST_FOR_ERROR( r ) __testForError( r, __LINE__, __FILE__ ) |
|
26 #define __testForError(x,l,f) testForError(x,l,_S(f)) |
|
27 _LIT( KErrorFailString, "Test failed with error %d"); |
|
28 inline void testForError( TInt aCode, TInt aLine, const TText* aFileName ) |
|
29 { |
|
30 if( aCode != KErrNone ) |
|
31 { |
|
32 test.Printf( KErrorFailString, aCode ); |
|
33 test.operator()( EFalse, aLine, aFileName ); |
|
34 } |
|
35 } |
|
36 |
|
37 #define TEST_FOR_MATCH( r, m ) __testForMatch( (TUint)(r), (TUint)(m), __LINE__, __FILE__ ) |
|
38 #define __testForMatch(r,m,l,f) testForMatch(r,m,l,_S(f)) |
|
39 _LIT( KMatchFailString, "Test failed, expected %d; got %d"); |
|
40 inline void testForMatch( TUint aValue, TUint aExpected, TInt aLine, const TText* aFileName ) |
|
41 { |
|
42 if( aValue != aExpected ) |
|
43 { |
|
44 test.Printf( KMatchFailString, aExpected, aValue ); |
|
45 test.operator()( EFalse, aLine, aFileName ); |
|
46 } |
|
47 } |
|
48 |
|
49 |
|
50 |
|
51 #endif |