1.1 --- a/epoc32/include/e32test.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/e32test.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,9 +1,9 @@
1.4 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 // All rights reserved.
1.6 // This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// under the terms of the License "Eclipse Public License v1.0"
1.9 // which accompanies this distribution, and is available
1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.12 //
1.13 // Initial Contributors:
1.14 // Nokia Corporation - initial contribution.
1.15 @@ -15,8 +15,6 @@
1.16 //
1.17 //
1.18
1.19 -
1.20 -
1.21 /**
1.22 @file e32test.h
1.23 @publishedAll
1.24 @@ -26,11 +24,18 @@
1.25 #ifndef __E32TEST_H__
1.26 #define __E32TEST_H__
1.27 #include <e32std.h>
1.28 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
1.29 +#include <e32std_private.h>
1.30 +#include <e32base_private.h>
1.31 +#endif
1.32 #include <e32base.h>
1.33 #include <e32cons.h>
1.34 -#include <e32ver.h>
1.35 #include <e32kpan.h>
1.36 #include <e32debug.h>
1.37 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
1.38 +#include <e32def_private.h>
1.39 +#include <e32event_private.h>
1.40 +#endif
1.41
1.42
1.43 /**
1.44 @@ -66,6 +71,7 @@
1.45 inline void HandleNull(TInt aLine, const TText* aFileName);
1.46 inline void HandleNotEqual(TInt aExpected, TInt aActual, TInt aLine, const TText* aFileName);
1.47 inline void HandleFailedCompare(TInt aLeft, const TText* aComp, TInt aRight, TInt aLine, const TText* aFileName);
1.48 + inline void HandleValue(TInt aValue, TInt aLine, const TText* aFileName);
1.49
1.50 IMPORT_C static TInt CloseHandleAndWaitForDestruction(RHandleBase& aH); /**< @internalTechnology */
1.51
1.52 @@ -203,48 +209,56 @@
1.53 /**
1.54 @internalComponent
1.55
1.56 -Panics and displays an approprate error message if x is less then zero (Indicating an error code).
1.57 +Panics and displays an appropriate error message if x is less then zero (Indicating an error code).
1.58 */
1.59 #define test_NotNegative(x) { TInt _r = (x); if (_r < 0) test.HandleError(_r, __LINE__,__S(__FILE__)); }
1.60
1.61 /**
1.62 @internalComponent
1.63
1.64 -Panics and displays an approprate error message if x is not equal to KErrNone.
1.65 +Panics and displays an appropriate error message if x is not equal to KErrNone.
1.66 */
1.67 #define test_KErrNone(x) { TInt _r = (x); if (_r !=KErrNone) test.HandleError(_r, __LINE__,__S(__FILE__)); }
1.68
1.69 /**
1.70 @internalComponent
1.71
1.72 -Panics and displays an approprate error message if the trapped statement/block x leaves.
1.73 +Panics and displays an appropriate error message if the trapped statement/block x leaves.
1.74 */
1.75 -#define test_TRAP(x) { TRAPD(_r, x); if (_r !=KErrNone) test.HandleError(_r, __LINE__,__S(__FILE__)); }
1.76 +#define test_TRAP(x) { TRAPD(_r, x); if (_r != KErrNone) test.HandleError(_r, __LINE__,__S(__FILE__)); }
1.77
1.78 /**
1.79 @internalComponent
1.80
1.81 -Panics and displays an approprate error message if x is not equal to NULL.
1.82 +Panics and displays an appropriate error message if x is not equal to NULL.
1.83 */
1.84 #define test_NotNull(x) { TAny* _a = (TAny*)(x); if (_a == NULL) test.HandleNull(__LINE__,__S(__FILE__)); }
1.85 /**
1.86 @internalComponent
1.87
1.88 -Panics and displays an approprate error message if e (expected) is not equal to a (actual).
1.89 +Panics and displays an appropriate error message if e (expected) is not equal to a (actual).
1.90 */
1.91 #define test_Equal(e, a) { TInt _e = TInt(e); TInt _a = TInt(a); if (_e != _a) test.HandleNotEqual(_e, _a, __LINE__,__S(__FILE__)); }
1.92
1.93 /**
1.94 @internalComponent
1.95
1.96 -Panics and displays an approprate error message if the comparison specifed with b, between a and c is EFalse.
1.97 +Panics and displays an appropriate error message if the comparison specified with operator b, between a and c, is EFalse.
1.98 */
1.99 #define test_Compare(a,b,c) {TInt _a = TInt(a); TInt _c = TInt(c); if (!(_a b _c)) test.HandleFailedCompare(_a, __S(#b), _c, __LINE__,__S(__FILE__)); }
1.100 -
1.101 +
1.102 +
1.103 /**
1.104 @internalComponent
1.105
1.106 -If the expressione e is false, the the statment s is exectude before a Panic is raised.
1.107 +Panics and displays an appropriate error message displaying v, if the expression e is false.
1.108 +*/
1.109 +#define test_Value(v, e) if (!(e)) test.HandleValue(v, __LINE__,__S(__FILE__));
1.110 +
1.111 +/**
1.112 +@internalComponent
1.113 +
1.114 +If expression e is false, statement s is executed then a Panic is raised.
1.115 */
1.116 #define test_Assert(e,s) if(!(e)) {s; test.operator()(EFalse, __LINE__,__S(__FILE__)); }
1.117
1.118 @@ -326,6 +340,22 @@
1.119
1.120
1.121 /**
1.122 +Prints a failure message indicating that aValue was not an expected value, at the console and raises a panic.
1.123 +
1.124 +@param aValue The value that is to be printed as not being an expected value.
1.125 +@param aLineNum A line number that is printed in the failure message.
1.126 +@param aFileName A file name that is printed in the failure message.
1.127 +
1.128 +@panic USER 84 Always.
1.129 +*/
1.130 +inline void RTest::HandleValue(TInt aValue, TInt aLine, const TText* aFileName)
1.131 + {
1.132 + Printf(_L("RTEST: %d (0x%x) was not an expected value.\n"), aValue, aValue);
1.133 + operator()(EFalse, aLine, aFileName);
1.134 + }
1.135 +
1.136 +
1.137 +/**
1.138 @internalTechnology
1.139 */
1.140 _LIT(KLitCloseAndWait,"Close&Wait");
1.141 @@ -335,4 +365,7 @@
1.142 */
1.143 #define CLOSE_AND_WAIT(h) ((void)(RTest::CloseHandleAndWaitForDestruction(h) && (User::Panic(KLitCloseAndWait,__LINE__),1)))
1.144
1.145 +
1.146 +
1.147 #endif
1.148 +