From d4b273c2c160957e8de3fb70ed0843f4b3df6d8b Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Thu, 9 Feb 2012 11:02:17 +0100 Subject: test-ippool: Test overlapping ranges --- unit/test-ippool.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'unit/test-ippool.c') diff --git a/unit/test-ippool.c b/unit/test-ippool.c index 9159547f..2df85618 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(); } -- cgit v1.2.3