-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathexample8.m
More file actions
33 lines (28 loc) · 909 Bytes
/
example8.m
File metadata and controls
33 lines (28 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#import "Testing.h"
#import <Foundation/NSRange.h>
/* An eighth test ... complex code fragments
*
* If you run the test with 'gnustep-tests example8.m' it should
* report one test pass.
*/
int
main()
{
/* Start a set.
*/
START_SET("example set")
/* 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")
END_SET("example set")
return 0;
}