2011-02-16 08:21:17 +00:00
|
|
|
#import "ObjectTesting.h"
|
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
#import <Foundation/NSProxy.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
|
|
char *prefix = "Class 'NSProxy'";
|
|
|
|
Class theClass = Nil;
|
|
|
|
id obj0;
|
|
|
|
id obj1;
|
|
|
|
NSZone *testZone = NSCreateZone(1024,1024,1);
|
|
|
|
|
|
|
|
theClass = [NSProxy class];
|
|
|
|
PASS(theClass != Nil, "%s exists",prefix);
|
|
|
|
obj0 = [NSProxy alloc];
|
|
|
|
PASS(obj0 != nil, "%s has working alloc",prefix);
|
2011-02-24 16:26:01 +00:00
|
|
|
PASS_EXCEPTION([obj0 isKindOfClass:theClass];, NSInvalidArgumentException,
|
|
|
|
"NSProxy -isKindOfClass raises exception");
|
2011-02-16 08:21:17 +00:00
|
|
|
|
2011-02-24 16:26:01 +00:00
|
|
|
PASS_EXCEPTION([obj0 isMemberOfClass:theClass];,
|
|
|
|
NSInvalidArgumentException,
|
2011-02-16 08:21:17 +00:00
|
|
|
"NSProxy -isKindOfClass raises exception");
|
|
|
|
|
|
|
|
obj1 = [NSProxy allocWithZone:testZone];
|
|
|
|
PASS(obj1 != nil, "%s has working allocWithZone:",prefix);
|
|
|
|
PASS(NSZoneFromPointer(obj1) == testZone, "%s uses zone for alloc",prefix);
|
|
|
|
PASS([obj1 zone] == testZone, "%s -zone works",prefix);
|
|
|
|
|
|
|
|
PASS([obj1 hash] != 0, "%s has working -hash",prefix);
|
|
|
|
PASS([obj1 isEqual:obj1] == YES, "%s has working -isEqual:",prefix);
|
|
|
|
PASS([obj1 class] == theClass, "%s has working -class",prefix);
|
|
|
|
|
|
|
|
[arp release]; arp = nil;
|
|
|
|
return 0;
|
|
|
|
}
|