/*!
@header ECTestcase
@abstract Module of Encore
@availability OS X, GNUstep
@copyright 2004, 2005, 2006 Oliver Langer
Author: Oliver Langer
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-------------------------------------------------------------------------
Modification history
20.11.05 ola initial version
22.08.06 ola license changed
-------------------------------------------------------------------------
*/
#if !defined(__Testcase_h)
#define __Testcase_h
#include
#include
/*!
* @class ECTestcase
* @abstract All test cases may be derived from this base class
*/
@interface ECTestcase : ECObject
/*!
* @method setup
* @abstract called directly before the launch of this testcase
* @result self
*/
- setup;
/*!
* @method cleanup
* @abstract directly called after the launch of this testcase
* @result self
*/
- cleanup;
@end
/*!
* @macro ECAssertTrue
* @abstract Evaluates the given expression and throws an
* {@link ECAssertionException} in case the expression
* equals NO
* @param __expr expression to evaluate. Must be of type BOOL
* @param __msg message to print out in conjunction with the assertion
* failure. Must be of type NSString
*/
#define ECAssertTrue(__expr, __msg)\
if(!(__expr)) {\
NSLog( (__msg));\
[[[ECAssertionException alloc] \
initWithAssertionInfo: \
[[[NSString alloc]\
initWithFormat:@"Assertion failed in %s at line %u with message"\
"\"%@\"",__FILE__, __LINE__, __msg] autorelease]] raise];\
}
/*!
* @macro ECAssertFalse
* @abstract Evaluates the given expression and throws an
* {@link ECAssertionException} in case the expression
* equals NO
* @param __expr expression to evaluate. Must be of type BOOL
* @param __msg message to print out in conjunction with the assertion
* failure. Must be of type NSString
*/
#define ECAssertFalse(__expr, __msg)\
if((__expr)) {\
NSLog( (__msg));\
[[[ECAssertionException alloc] \
initWithAssertionInfo: \
[[[NSString alloc]\
initWithFormat:@"Assertion failed in %s at line %u with message"\
"\"%@\"",__FILE__, __LINE__, __msg] autorelease]] raise];\
}
#endif