X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=unit%2Ftest-ippool.c;h=a6cae652976e6f338f3616e947cc8868064ef011;hb=f2a9f93bbb2df62e3b3246ea253f8aaae29234d2;hp=e8d077a65a11ff4b3c14bcbef78c9e645bb33533;hpb=bcae74da8fa2958b3fec9153fc33e41f0e0317bf;p=platform%2Fupstream%2Fconnman.git diff --git a/unit/test-ippool.c b/unit/test-ippool.c old mode 100644 new mode 100755 index e8d077a..a6cae65 --- a/unit/test-ippool.c +++ b/unit/test-ippool.c @@ -53,7 +53,7 @@ static void test_case_1(void) pool = __connman_ippool_create(23, 1, 20, NULL, NULL); g_assert(pool); - __connman_ippool_unref(pool); + __connman_ippool_free(pool); } __connman_ippool_cleanup(); @@ -92,7 +92,7 @@ static void test_case_2(void) "\tgateway %s broadcast %s mask %s", start_ip, end_ip, gateway, broadcast, subnet_mask); - __connman_ippool_unref(pool); + __connman_ippool_free(pool); } __connman_ippool_cleanup(); @@ -157,7 +157,7 @@ static void test_case_3(void) for (it = list; it; it = it->next) { pool = it->data; - __connman_ippool_unref(pool); + __connman_ippool_free(pool); } g_slist_free(list); @@ -219,7 +219,7 @@ static void test_case_4(void) g_assert(flag == 1); - __connman_ippool_unref(pool); + __connman_ippool_free(pool); flag = 0; @@ -246,14 +246,14 @@ static void test_case_4(void) g_assert(flag == 1); - __connman_ippool_unref(pool); + __connman_ippool_free(pool); __connman_ippool_cleanup(); } 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_free(pool1); + __connman_ippool_free(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_free(pool1); + __connman_ippool_free(pool2); __connman_ippool_cleanup(); }