File: basic.m

package info (click to toggle)
gnustep-base 1.31.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,580 kB
  • sloc: objc: 239,446; ansic: 36,519; cpp: 122; sh: 112; makefile: 100; xml: 32
file content (41 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
#import "ObjectTesting.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSProxy.h>
#if __has_include(<objc/capabilities.h>)
#include <objc/capabilities.h>
#endif

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 = AUTORELEASE([NSProxy alloc]);
  PASS(obj0 != nil, "%s has working alloc",prefix);
  PASS_EXCEPTION([obj0 isKindOfClass:theClass];, NSInvalidArgumentException,
  		 "NSProxy -isKindOfClass raises exception");
  
  PASS_EXCEPTION([obj0 isMemberOfClass:theClass];, 
                 NSInvalidArgumentException,
		 "NSProxy -isKindOfClass raises exception");
  
  obj1 = AUTORELEASE([NSProxy allocWithZone:testZone]);
  PASS(obj1 != nil, "%s has working allocWithZone:",prefix);
#ifndef OBJC_CAP_ARC
  PASS(NSZoneFromPointer(obj1) == testZone, "%s uses zone for alloc",prefix);
  PASS([obj1 zone] == testZone, "%s -zone works",prefix);
#endif
  
  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;
}