2011-02-22 14:53:39 +00:00
|
|
|
#import "Testing.h"
|
2011-02-25 17:42:21 +00:00
|
|
|
#import <Foundation/NSRange.h>
|
2011-02-13 17:25:55 +00:00
|
|
|
|
|
|
|
/* An eighth test ... complex code fragments
|
|
|
|
*
|
|
|
|
* If you run the test with 'gnustep-tests example8.m' it should
|
2011-02-16 05:44:45 +00:00
|
|
|
* report one test pass.
|
2011-02-13 17:25:55 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
/* Start a set.
|
|
|
|
*/
|
2011-02-24 16:26:01 +00:00
|
|
|
START_SET("example set")
|
2011-02-13 17:25:55 +00:00
|
|
|
|
|
|
|
/* Here we demonstrate that the 'expression' evaluated by the PASS
|
|
|
|
* macro can actually be an arbitrarily complex piece of code as
|
|
|
|
* long as the last statement returns an integral value which can
|
|
|
|
* be used to represent a pass (non zero) or fail (if zero).
|
|
|
|
* Where such a code fragment contains commas, it must be written
|
|
|
|
* inside brackets to let the macro preprocessor know that the whole
|
|
|
|
* code fragement is the first parameter to the macro.
|
|
|
|
*/
|
|
|
|
PASS(({
|
|
|
|
NSRange r = NSMakeRange(1, 10);
|
|
|
|
|
|
|
|
NSEqualRanges(r, NSMakeRange(1, 10));
|
|
|
|
}), "a long code-fragment/expression works")
|
|
|
|
|
2011-02-24 16:26:01 +00:00
|
|
|
END_SET("example set")
|
2011-02-13 17:25:55 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|