ether_test.c (290563) | ether_test.c (291175) |
---|---|
1/*- 2 * Copyright (c) 2007 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2007 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libc/tests/net/ether_test.c 290563 2015-11-08 23:06:40Z ngie $ | 26 * $FreeBSD: stable/10/lib/libc/tests/net/ether_test.c 291175 2015-11-23 08:22:40Z ngie $ |
27 */ 28 29#include <sys/types.h> 30 31#include <net/ethernet.h> 32 33#include <errno.h> 34#include <stdio.h> --- 25 unchanged lines hidden (view full) --- 60 61ATF_TC_WITHOUT_HEAD(ether_line_bad_1); 62ATF_TC_BODY(ether_line_bad_1, tc) 63{ 64 struct ether_addr e; 65 char hostname[256]; 66 67 ATF_REQUIRE_MSG(ether_line(ether_line_bad_1_string, &e, hostname) != 0, | 27 */ 28 29#include <sys/types.h> 30 31#include <net/ethernet.h> 32 33#include <errno.h> 34#include <stdio.h> --- 25 unchanged lines hidden (view full) --- 60 61ATF_TC_WITHOUT_HEAD(ether_line_bad_1); 62ATF_TC_BODY(ether_line_bad_1, tc) 63{ 64 struct ether_addr e; 65 char hostname[256]; 66 67 ATF_REQUIRE_MSG(ether_line(ether_line_bad_1_string, &e, hostname) != 0, |
68 "ether_line succeeded unexpectedly", errno); | 68 "ether_line succeeded unexpectedly"); |
69} 70 71static const char *ether_line_bad_2_string = "x x"; 72 73ATF_TC_WITHOUT_HEAD(ether_line_bad_2); 74ATF_TC_BODY(ether_line_bad_2, tc) 75{ 76 struct ether_addr e; 77 char hostname[256]; 78 79 ATF_REQUIRE_MSG(ether_line(ether_line_bad_2_string, &e, hostname) != 0, | 69} 70 71static const char *ether_line_bad_2_string = "x x"; 72 73ATF_TC_WITHOUT_HEAD(ether_line_bad_2); 74ATF_TC_BODY(ether_line_bad_2, tc) 75{ 76 struct ether_addr e; 77 char hostname[256]; 78 79 ATF_REQUIRE_MSG(ether_line(ether_line_bad_2_string, &e, hostname) != 0, |
80 "ether_line succeeded unexpectedly", errno); | 80 "ether_line succeeded unexpectedly"); |
81} 82 83static const char *ether_aton_string = "01:23:45:67:89:ab"; 84static const struct ether_addr ether_aton_addr = { 85 { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } 86}; 87 88ATF_TC_WITHOUT_HEAD(ether_aton_r); 89ATF_TC_BODY(ether_aton_r, tc) 90{ 91 struct ether_addr e, *ep; 92 93 ep = ether_aton_r(ether_aton_string, &e); 94 | 81} 82 83static const char *ether_aton_string = "01:23:45:67:89:ab"; 84static const struct ether_addr ether_aton_addr = { 85 { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } 86}; 87 88ATF_TC_WITHOUT_HEAD(ether_aton_r); 89ATF_TC_BODY(ether_aton_r, tc) 90{ 91 struct ether_addr e, *ep; 92 93 ep = ether_aton_r(ether_aton_string, &e); 94 |
95 ATF_REQUIRE_MSG(ep != NULL, "ether_aton_r failed", errno); | 95 ATF_REQUIRE_MSG(ep != NULL, "ether_aton_r failed; errno=%d", errno); |
96 ATF_REQUIRE_MSG(ep == &e, 97 "ether_aton_r returned different pointers; %p != %p", ep, &e); 98} 99 100static const char *ether_aton_bad_string = "x"; 101 102ATF_TC_WITHOUT_HEAD(ether_aton_r_bad); 103ATF_TC_BODY(ether_aton_r_bad, tc) --- 89 unchanged lines hidden --- | 96 ATF_REQUIRE_MSG(ep == &e, 97 "ether_aton_r returned different pointers; %p != %p", ep, &e); 98} 99 100static const char *ether_aton_bad_string = "x"; 101 102ATF_TC_WITHOUT_HEAD(ether_aton_r_bad); 103ATF_TC_BODY(ether_aton_r_bad, tc) --- 89 unchanged lines hidden --- |