]> git.saurik.com Git - apple/libdispatch.git/blob - testing/nsoperation.m
libdispatch-84.5.3.tar.gz
[apple/libdispatch.git] / testing / nsoperation.m
1 #include <stdlib.h>
2 #include <assert.h>
3 #include <stdio.h>
4 #include <string.h>
5
6 #include <Foundation/Foundation.h>
7 #include <dispatch/dispatch.h>
8
9 #include "dispatch_test.h"
10
11 @interface MYOperation : NSOperation
12 {
13 }
14 @end
15
16 @implementation MYOperation
17
18 - (id) init
19 {
20 self = [super init];
21 return self;
22 }
23
24 - (void)main
25 {
26 test_stop();
27 }
28
29 @end
30
31 int
32 main(void)
33 {
34 test_start("NSOperation");
35
36 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
37
38 NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease];
39 test_ptr_notnull("NSOperationQueue", queue);
40
41 MYOperation *operation = [[MYOperation alloc] init];
42 test_ptr_notnull("NSOperation", operation);
43
44 [queue addOperation:operation];
45 [operation release];
46
47 [[NSRunLoop mainRunLoop] run];
48
49 [pool release];
50
51 return 0;
52 }