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

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
#import <Foundation/Foundation.h>
#import "Testing.h"

int main()
{
  NSAutoreleasePool   *arp = [NSAutoreleasePool new];
  BOOL ret;
  NSLock *lock = [NSRecursiveLock new];
  ret = [lock tryLock];
  if (ret)
    [lock unlock];
  PASS(ret, "NSRecursiveLock with tryLock, then unlocking");
  
  ASSIGN(lock,[NSRecursiveLock new]);
  ret = [lock lockBeforeDate:[NSDate dateWithTimeIntervalSinceNow:1]];
  if (ret)
    [lock unlock];
  PASS(ret, "NSRecursiveLock lockBeforeDate: works");
  
  ASSIGN(lock,[NSRecursiveLock new]);
  [lock tryLock];
  ret = [lock lockBeforeDate:[NSDate dateWithTimeIntervalSinceNow:1]];
  if (ret)
    [lock unlock];
  PASS(ret, "NSRecursiveLock lockBeforeDate: with NSRecursiveLock returns YES");

  [arp release]; arp = nil;
  return 0;
}