~ubuntu-branches/ubuntu/trusty/gnustep-base/trusty-proposed

« back to all changes in this revision

Viewing changes to Tests/base/NSMapTable/create.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 "ObjectTesting.h"
 
2
#import <Foundation/NSMapTable.h>
 
3
#import <Foundation/NSAutoreleasePool.h>
 
4
 
 
5
int main()
 
6
{
 
7
  NSAutoreleasePool   *arp = [NSAutoreleasePool new];
 
8
  NSString *val1, *val2, *val3;
 
9
  NSMapTable *obj, *old;
 
10
  id vals[3];
 
11
  
 
12
  val1 = @"Hello";
 
13
  val2 = @"Goodbye";
 
14
  val3 = @"Testing";
 
15
  
 
16
  vals[0] = val1;
 
17
  vals[1] = val2;
 
18
  vals[2] = val3;
 
19
 
 
20
  obj = [[NSMapTable new] autorelease];
 
21
  PASS(obj != nil
 
22
    && [obj isKindOfClass:[NSMapTable class]]
 
23
    && [obj count] == 0,
 
24
    "+new creates an empty hash table");
 
25
  
 
26
  [obj setObject: val1 forKey: @"Key1"];
 
27
  PASS([obj count] == 1, "-setObject:forKey increments count");
 
28
  [obj setObject: nil forKey: @"Key2"];
 
29
  PASS([obj count] == 2, "-setObject:forKey: works with nil value");
 
30
  PASS_EXCEPTION([obj setObject: val1 forKey: nil];,
 
31
    NSInvalidArgumentException, "-setObject:forKey: raises with nil key");
 
32
 
 
33
  [arp release]; arp = nil;
 
34
  return 0;
 
35
 
36