2011-02-16 08:21:17 +00:00
|
|
|
#import "ObjectTesting.h"
|
|
|
|
#import <Foundation/NSHost.h>
|
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
|
|
NSHost *current;
|
|
|
|
NSHost *localh;
|
|
|
|
NSHost *tmp;
|
|
|
|
|
|
|
|
current = [NSHost currentHost];
|
2011-10-03 16:03:19 +00:00
|
|
|
PASS(current != nil && [current isKindOfClass: [NSHost class]],
|
2011-02-16 08:21:17 +00:00
|
|
|
"NSHost understands +currentHost");
|
|
|
|
|
|
|
|
#if defined(GNUSTEP_BASE_LIBRARY)
|
|
|
|
localh = [NSHost localHost];
|
2011-10-03 16:03:19 +00:00
|
|
|
PASS(localh != nil && [localh isKindOfClass: [NSHost class]],
|
2011-02-16 08:21:17 +00:00
|
|
|
"NSHost understands +localHost");
|
|
|
|
#else
|
|
|
|
localh = current;
|
|
|
|
#endif
|
|
|
|
|
2011-10-03 16:03:19 +00:00
|
|
|
tmp = [NSHost hostWithName: @"::1"];
|
|
|
|
PASS([[tmp address] isEqual: @"::1"], "+hostWithName: works for IPV6 addr");
|
|
|
|
|
|
|
|
tmp = [NSHost hostWithName: [current name]];
|
|
|
|
PASS([tmp isEqualToHost: current], "NSHost understands +hostWithName:");
|
2011-02-16 08:21:17 +00:00
|
|
|
|
2011-10-03 16:03:19 +00:00
|
|
|
tmp = [NSHost hostWithAddress: [current address]];
|
|
|
|
PASS([tmp isEqualToHost: current], "NSHost understands +hostWithAddress:");
|
2011-02-16 08:21:17 +00:00
|
|
|
|
2011-10-03 16:03:19 +00:00
|
|
|
tmp = [NSHost hostWithName: @"127.0.0.1"];
|
|
|
|
PASS(tmp != nil && [tmp isEqualToHost: localh],
|
2011-02-16 08:21:17 +00:00
|
|
|
"NSHost understands [+hostWithName: 127.0.0.1]");
|
|
|
|
|
|
|
|
[arp release]; arp = nil;
|
|
|
|
return 0;
|
|
|
|
}
|