diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2015-07-31 20:23:19 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2015-07-31 20:23:19 +0200 |
commit | 36fd91826011fa8877c4b7f198e7179bfa0162b2 (patch) | |
tree | c5a7a3edfc04e78d104dde769d7727cf954e3845 /src/test/test-socket-util.c | |
parent | 6f7897f9d2bd5ec7d6a9be8ad700661bb17a21cf (diff) | |
parent | e76398868a154258c3620be2bdecdd9fa7cdf093 (diff) |
Merge pull request #812 from zonque/test
Add some more tests
Diffstat (limited to 'src/test/test-socket-util.c')
-rw-r--r-- | src/test/test-socket-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index f257af445a..2c18090ae5 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -158,6 +158,20 @@ static void test_socket_address_is_netlink(void) { assert_se(!socket_address_is_netlink(&a, "route 1")); } +static void test_in_addr_is_null(void) { + + union in_addr_union i = {}; + + assert_se(in_addr_is_null(AF_INET, &i) == true); + assert_se(in_addr_is_null(AF_INET6, &i) == true); + + i.in.s_addr = 0x1000000; + assert_se(in_addr_is_null(AF_INET, &i) == false); + assert_se(in_addr_is_null(AF_INET6, &i) == false); + + assert_se(in_addr_is_null(-1, &i) == -EAFNOSUPPORT); +} + static void test_in_addr_prefix_intersect_one(unsigned f, const char *a, unsigned apl, const char *b, unsigned bpl, int result) { union in_addr_union ua, ub; @@ -340,6 +354,7 @@ int main(int argc, char *argv[]) { test_socket_address_is(); test_socket_address_is_netlink(); + test_in_addr_is_null(); test_in_addr_prefix_intersect(); test_in_addr_prefix_next(); test_in_addr_to_string(); |