Differences From Artifact [6221b31ff7]:
- File tests/OFSCTPSocketTests.m — part of check-in [0765df9754] at 2020-05-09 13:41:33 on branch trunk — Add tests for OFSCTPSocket (user: js, size: 1691) [annotate] [blame] [check-ins using]
To Artifact [769c4509cc]:
- File
tests/OFSCTPSocketTests.m
— part of check-in
[e8857652bf]
at
2020-05-19 22:00:40
on branch trunk
— tests: Gracefully handle SCTP being unsupported
NetBSD has the necessary headers, but does not enable it by default. (user: js, size: 2037) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #import "TestsAppDelegate.h" static OFString *module = @"OFSCTPSocket"; @implementation TestsAppDelegate (OFSCTPSocketTests) - (void)SCTPSocketTests { void *pool = objc_autoreleasePoolPush(); OFSCTPSocket *server, *client = nil, *accepted; uint16_t port; char buf[6]; TEST(@"+[socket]", (server = [OFSCTPSocket socket]) && (client = [OFSCTPSocket socket])) | > > | | | > > > > > > > > > > > > > > > | 13 14 15 16 17 18 19 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 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <errno.h> #include <string.h> #import "TestsAppDelegate.h" static OFString *module = @"OFSCTPSocket"; @implementation TestsAppDelegate (OFSCTPSocketTests) - (void)SCTPSocketTests { void *pool = objc_autoreleasePoolPush(); OFSCTPSocket *server, *client = nil, *accepted; uint16_t port; char buf[6]; TEST(@"+[socket]", (server = [OFSCTPSocket socket]) && (client = [OFSCTPSocket socket])) @try { TEST(@"-[bindToHost:port:]", (port = [server bindToHost: @"127.0.0.1" port: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EPROTONOSUPPORT: [self outputString: @"[OFSCTPSocket] " @"-[bindToHost:port:]: SCTP " @"unsupported, skipping tests\n" inColor: GREEN]; break; default: @throw e; } objc_autoreleasePoolPop(pool); return; } TEST(@"-[listen]", R([server listen])) TEST(@"-[connectToHost:port:]", R([client connectToHost: @"127.0.0.1" port: port])) |
︙ | ︙ |