summaryrefslogtreecommitdiff
path: root/unit
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2018-01-08 13:42:54 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2018-01-08 13:43:31 +0900
commit9362752a471a5c892d679548fbf2828d5fc5684b (patch)
tree83c7d29a28556906938f5c2198d81e2d35f86f92 /unit
parent22633ced6225d294ce8483efbf2b39ea0c0c1b65 (diff)
downloadconnman-9362752a471a5c892d679548fbf2828d5fc5684b.tar.gz
connman-9362752a471a5c892d679548fbf2828d5fc5684b.tar.bz2
connman-9362752a471a5c892d679548fbf2828d5fc5684b.zip
Imported Upstream version 1.35upstream/1.35
Change-Id: I174854914d9fd06a813270b57d1f7bc2bac63c6a Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
Diffstat (limited to 'unit')
-rw-r--r--unit/test-ippool.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/unit/test-ippool.c b/unit/test-ippool.c
index e8d077a6..17fac9d9 100644
--- a/unit/test-ippool.c
+++ b/unit/test-ippool.c
@@ -253,7 +253,7 @@ static void test_case_4(void)
static void test_case_5(void)
{
- struct connman_ippool *pool;
+ struct connman_ippool *pool1, *pool2;
const char *gateway;
const char *broadcast;
const char *subnet_mask;
@@ -271,14 +271,14 @@ static void test_case_5(void)
g_assert(flag == 0);
/* pool should return 192.168.0.1 now */
- pool = __connman_ippool_create(26, 1, 100, collision_cb, &flag);
- g_assert(pool);
+ pool1 = __connman_ippool_create(26, 1, 100, collision_cb, &flag);
+ g_assert(pool1);
- 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);
+ gateway = __connman_ippool_get_gateway(pool1);
+ broadcast = __connman_ippool_get_broadcast(pool1);
+ subnet_mask = __connman_ippool_get_subnet_mask(pool1);
+ start_ip = __connman_ippool_get_start_ip(pool1);
+ end_ip = __connman_ippool_get_end_ip(pool1);
g_assert(gateway);
g_assert(broadcast);
@@ -296,8 +296,6 @@ static void test_case_5(void)
"\tgateway %s broadcast %s mask %s", start_ip, end_ip,
gateway, broadcast, subnet_mask);
- __connman_ippool_unref(pool);
-
/*
* Now create the pool again, we should not get collision
* with existing allocated address.
@@ -305,14 +303,14 @@ static void test_case_5(void)
/* pool should return 192.168.2.1 now */
flag = 0;
- pool = __connman_ippool_create(23, 1, 100, collision_cb, &flag);
- g_assert(pool);
+ pool2 = __connman_ippool_create(23, 1, 100, collision_cb, &flag);
+ g_assert(pool2);
- 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);
+ gateway = __connman_ippool_get_gateway(pool2);
+ broadcast = __connman_ippool_get_broadcast(pool2);
+ subnet_mask = __connman_ippool_get_subnet_mask(pool2);
+ start_ip = __connman_ippool_get_start_ip(pool2);
+ end_ip = __connman_ippool_get_end_ip(pool2);
g_assert(gateway);
g_assert(broadcast);
@@ -332,14 +330,15 @@ static void test_case_5(void)
g_assert(flag == 0);
- __connman_ippool_unref(pool);
+ __connman_ippool_unref(pool1);
+ __connman_ippool_unref(pool2);
__connman_ippool_cleanup();
}
static void test_case_6(void)
{
- struct connman_ippool *pool;
+ struct connman_ippool *pool1, *pool2;
const char *gateway;
const char *broadcast;
const char *subnet_mask;
@@ -362,14 +361,14 @@ static void test_case_6(void)
g_assert(flag == 0);
/* pool should return 192.168.2.1 now */
- pool = __connman_ippool_create(26, 1, 100, collision_cb, &flag);
- g_assert(pool);
+ pool1 = __connman_ippool_create(26, 1, 100, collision_cb, &flag);
+ g_assert(pool1);
- 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);
+ gateway = __connman_ippool_get_gateway(pool1);
+ broadcast = __connman_ippool_get_broadcast(pool1);
+ subnet_mask = __connman_ippool_get_subnet_mask(pool1);
+ start_ip = __connman_ippool_get_start_ip(pool1);
+ end_ip = __connman_ippool_get_end_ip(pool1);
g_assert(gateway);
g_assert(broadcast);
@@ -387,8 +386,6 @@ static void test_case_6(void)
"\tgateway %s broadcast %s mask %s", start_ip, end_ip,
gateway, broadcast, subnet_mask);
- __connman_ippool_unref(pool);
-
/*
* Now create the pool again, we should not get collision
* with existing allocated address.
@@ -396,14 +393,14 @@ static void test_case_6(void)
/* pool should return 192.168.3.1 now */
flag = 0;
- pool = __connman_ippool_create(23, 1, 100, collision_cb, &flag);
- g_assert(pool);
+ pool2 = __connman_ippool_create(23, 1, 100, collision_cb, &flag);
+ g_assert(pool2);
- 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);
+ gateway = __connman_ippool_get_gateway(pool2);
+ broadcast = __connman_ippool_get_broadcast(pool2);
+ subnet_mask = __connman_ippool_get_subnet_mask(pool2);
+ start_ip = __connman_ippool_get_start_ip(pool2);
+ end_ip = __connman_ippool_get_end_ip(pool2);
g_assert(gateway);
g_assert(broadcast);
@@ -428,7 +425,8 @@ static void test_case_6(void)
__connman_ippool_newaddr(25, start_ip, 24);
g_assert(flag == 1);
- __connman_ippool_unref(pool);
+ __connman_ippool_unref(pool1);
+ __connman_ippool_unref(pool2);
__connman_ippool_cleanup();
}