From: Daniel Wagner Date: Thu, 9 Feb 2012 10:02:17 +0000 (+0100) Subject: test-ippool: Test overlapping ranges X-Git-Tag: 0.79~67 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fconnman.git;a=commitdiff_plain;h=d4b273c2c160957e8de3fb70ed0843f4b3df6d8b test-ippool: Test overlapping ranges --- diff --git a/unit/test-ippool.c b/unit/test-ippool.c index 9159547..2df8561 100644 --- a/unit/test-ippool.c +++ b/unit/test-ippool.c @@ -209,11 +209,39 @@ static void test_ippool_collision0(void) g_assert(flag == 0); - __connman_ippool_newaddr(42, start_ip, 24); + __connman_ippool_newaddr(42, start_ip, 16); g_assert(flag == 1); __connman_ippool_unref(pool); + + flag = 0; + + pool = __connman_ippool_create(23, 1, 100, collision_cb, &flag); + g_assert(pool); + + gateway = __connman_ippool_get_gateway(pool); + broadcast = __connman_ippool_get_broadcast(pool); + subnet_mask = __connman_ippool_get_subnet_mask(pool); + start_ip = __connman_ippool_get_start_ip(pool); + end_ip = __connman_ippool_get_end_ip(pool); + + g_assert(gateway); + g_assert(broadcast); + g_assert(subnet_mask); + g_assert(start_ip); + g_assert(end_ip); + + LOG("\n\tIP range %s --> %s\n" + "\tgateway %s broadcast %s mask %s", start_ip, end_ip, + gateway, broadcast, subnet_mask); + + __connman_ippool_newaddr(45, start_ip, 22); + + g_assert(flag == 1); + + __connman_ippool_unref(pool); + __connman_ippool_cleanup(); }