Signal-iOS/Signal/test/network/IpEndPointTest.m
Frederic Jacobs f6c0625c2c Removing unused imported classes.
//FREEBIE
2015-07-27 16:19:08 +02:00

25 lines
744 B
Objective-C

#import <XCTest/XCTest.h>
#import "TestUtil.h"
#import "IpAddress.h"
@interface IpEndPointTest : XCTestCase
@end
@implementation IpEndPointTest
-(void) testTrivial {
IpAddress* a = IpAddress.localhost;
IpEndPoint* p = [IpEndPoint ipEndPointAtAddress:a onPort:2];
test([p address] == a);
test([p port] == 2);
}
-(void) testFromSockaddrLoop {
for (NSString* s in @[@"4.5.6.7", @"2001:0db8:85a3:0001:0002:8a2e:0370:7334"]) {
IpAddress* a = [IpAddress ipAddressFromString:s];
IpEndPoint* p = [IpEndPoint ipEndPointFromSockaddrData:[[IpEndPoint ipEndPointAtAddress:a onPort:6] sockaddrData]];
test([[[p address] description] isEqualToString:[a description]]);
test([p port] == 6);
}
}
@end