~ubuntu-branches/ubuntu/wily/gnustep-base/wily

« back to all changes in this revision

Viewing changes to Tests/base/NSArray/basic.m

  • Committer: Package Import Robot
  • Author(s): Yavor Doganov
  • Date: 2011-09-15 12:31:15 UTC
  • mfrom: (1.2.11 upstream) (8.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20110915123115-rmvsia9z0211izvq
Tags: 1.22.1-1
* New upstream release:
  + Fixes implicit declaration of function (Closes: #629216).
* debian/rules (v_make): Set to 2.6.1.
  (install-common): Do not delete non-existent .swp file.
* debian/control.m4 (Build-Depends): Remove gobjc; gnustep-make now
  depends on it.
  (libgnustep-base-dev) <Depends>: Likewise.
  (Suggests): Remove; completely pointless.
* debian/control: Regenerate.
* debian/patches/avoid-nsl-linkage.patch: Refresh.
* debian/patches/autoreconf.patch: Regenerate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#import <Foundation/NSArray.h>
 
2
#import <Foundation/NSAutoreleasePool.h>
 
3
#import "ObjectTesting.h"
 
4
 
 
5
int main()
 
6
{
 
7
  NSArray *obj;
 
8
  NSMutableArray *testObjs = [[NSMutableArray alloc] init];
 
9
  NSString *str;
 
10
  NSAutoreleasePool   *arp = [NSAutoreleasePool new];
 
11
  test_alloc(@"NSArray"); 
 
12
  obj = [NSArray new];
 
13
  PASS((obj != nil && [obj count] == 0),"can create an empty array");
 
14
  str = @"hello";
 
15
  [testObjs addObject: obj];
 
16
  obj = [NSArray arrayWithObject:str];
 
17
  PASS((obj != nil && [obj count] == 1), "can create an array with one element");
 
18
  [testObjs addObject: obj];
 
19
  test_NSObject(@"NSArray", testObjs);
 
20
  test_NSCoding(testObjs);
 
21
  test_NSCopying(@"NSArray",@"NSMutableArray",testObjs,YES,NO);
 
22
  test_NSMutableCopying(@"NSArray",@"NSMutableArray",testObjs);
 
23
  
 
24
  obj = [NSArray arrayWithContentsOfFile: @"test.plist"];
 
25
  PASS((obj != nil && [obj count] > 0),"can create an array from file");
 
26
#if 1
 
27
  /* The apple foundation is arguably buggy in that it seems to create a
 
28
   * mutable array ... we currently copy that
 
29
   */
 
30
  PASS([obj isKindOfClass: [NSMutableArray class]] == YES,"array mutable");
 
31
  PASS_RUNS([obj addObject: @"x"],"can add to array");
 
32
#else
 
33
  PASS([obj isKindOfClass: [NSMutableArray class]] == NO,"array immutable");
 
34
#endif
 
35
  obj = [obj objectAtIndex: 0];
 
36
  PASS([obj isKindOfClass: [NSMutableArray class]] == YES,"array mutable");
 
37
  [arp release]; arp = nil;
 
38
  return 0;
 
39
}