Differences From Artifact [4dd5afc6b6]:
- File tests/OFIPXSocketTests.m — part of check-in [1a86b8175b] at 2022-02-12 07:46:07 on branch trunk — Update copyright (user: js, size: 1967) [annotate] [blame] [check-ins using] [more...]
To Artifact [abf65b2714]:
- File
tests/OFIPXSocketTests.m
— part of check-in
[af0f8118d0]
at
2022-11-06 21:24:30
on branch trunk
— OFIPXSocketTests: Do not compare sender network
It can be different due to IPX internal networks. (user: js, size: 2301) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "TestsAppDelegate.h" static OFString *const module = @"OFIPXSocket"; @implementation TestsAppDelegate (OFIPXSocketTests) - (void)IPXSocketTests { void *pool = objc_autoreleasePoolPush(); OFIPXSocket *sock; OFSocketAddress address1, address2; char buffer[5]; TEST(@"+[socket]", (sock = [OFIPXSocket socket])) @try { | > > | | > > > | | | | | > > > > | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #import "TestsAppDelegate.h" static OFString *const module = @"OFIPXSocket"; @implementation TestsAppDelegate (OFIPXSocketTests) - (void)IPXSocketTests { const unsigned char zeroNode[IPX_NODE_LEN] = { 0 }; void *pool = objc_autoreleasePoolPush(); OFIPXSocket *sock; OFSocketAddress address1, address2; char buffer[5]; unsigned char node1[IPX_NODE_LEN], node2[IPX_NODE_LEN]; TEST(@"+[socket]", (sock = [OFIPXSocket socket])) @try { TEST(@"-[bindToNetwork:node:port:packetType:]", R(address1 = [sock bindToNetwork: 0 node: zeroNode port: 0 packetType: 0])) } @catch (OFBindSocketFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: [OFStdOut setForegroundColor: [OFColor lime]]; [OFStdOut writeLine: @"\r[OFIPXSocket] -[bindToNetwork:node:port:" @"packetType:]: IPX unsupported, skipping tests"]; break; case EADDRNOTAVAIL: [OFStdOut setForegroundColor: [OFColor lime]]; [OFStdOut writeLine: @"\r[OFIPXSocket] -[bindToNetwork:node:port:" @"packetType:]: IPX not configured, skipping " @"tests"]; break; default: @throw e; } objc_autoreleasePoolPop(pool); return; } TEST(@"-[sendBuffer:length:receiver:]", R([sock sendBuffer: "Hello" length: 5 receiver: &address1])) TEST(@"-[receiveIntoBuffer:length:sender:]", [sock receiveIntoBuffer: buffer length: 5 sender: &address2] == 5 && memcmp(buffer, "Hello", 5) == 0 && R(OFSocketAddressGetIPXNode(&address1, node1)) && R(OFSocketAddressGetIPXNode(&address2, node2)) && memcmp(node1, node2, IPX_NODE_LEN) == 0 && OFSocketAddressIPXPort(&address1) == OFSocketAddressIPXPort(&address2)) objc_autoreleasePoolPop(pool); } @end |