diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-02-09 10:59:11 +0100 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-02-13 18:03:41 +0100 |
commit | 496d451ca3d07af67b22ab9d6dbfbd392d2b1868 (patch) | |
tree | 4341884f9fa93770c9df8016e03646212e55f86c /unit | |
parent | 4fba017873987d9bfff02567b562898c6364d320 (diff) | |
download | connman-496d451ca3d07af67b22ab9d6dbfbd392d2b1868.tar.gz connman-496d451ca3d07af67b22ab9d6dbfbd392d2b1868.tar.bz2 connman-496d451ca3d07af67b22ab9d6dbfbd392d2b1868.zip |
test-ippool: Reinit ippool for each test
Diffstat (limited to 'unit')
-rw-r--r-- | unit/test-ippool.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/unit/test-ippool.c b/unit/test-ippool.c index ebf8df4d..f710bd9d 100644 --- a/unit/test-ippool.c +++ b/unit/test-ippool.c @@ -44,12 +44,19 @@ static void test_ippool_basic0(void) struct connman_ippool *pool; int i; + __connman_ippool_init(); + + pool = __connman_ippool_create(23, 1, 500, NULL, NULL); + g_assert(pool == NULL); + for (i = 0; i < 100000; i++) { pool = __connman_ippool_create(23, 1, 20, NULL, NULL); g_assert(pool); __connman_ippool_unref(pool); } + + __connman_ippool_cleanup(); } static void test_ippool_basic1(void) @@ -62,6 +69,8 @@ static void test_ippool_basic1(void) const char *end_ip; int i; + __connman_ippool_init(); + /* Test the IP range */ for (i = 1; i < 254; i++) { pool = __connman_ippool_create(23, 1, i, NULL, NULL); @@ -85,6 +94,8 @@ static void test_ippool_basic1(void) __connman_ippool_unref(pool); } + + __connman_ippool_cleanup(); } static void test_ippool_basic2(void) @@ -98,6 +109,8 @@ static void test_ippool_basic2(void) GSList *list = NULL, *it; int i = 0; + __connman_ippool_init(); + /* Allocate all possible pools */ /* @@ -142,6 +155,8 @@ static void test_ippool_basic2(void) } g_slist_free(list); + + __connman_ippool_cleanup(); } static void collision_cb(struct connman_ippool *pool, void *user_data) @@ -166,6 +181,8 @@ static void test_ippool_collision0(void) const char *end_ip; int flag; + __connman_ippool_init(); + /* Test the IP range collision */ flag = 0; @@ -197,24 +214,17 @@ static void test_ippool_collision0(void) g_assert(flag == 1); __connman_ippool_unref(pool); + __connman_ippool_cleanup(); } int main(int argc, char *argv[]) { - int err; - g_test_init(&argc, &argv, NULL); - __connman_ippool_init(); - g_test_add_func("/basic0", test_ippool_basic0); g_test_add_func("/basic1", test_ippool_basic1); g_test_add_func("/basic2", test_ippool_basic2); g_test_add_func("/collision0", test_ippool_collision0); - err = g_test_run(); - - __connman_ippool_cleanup(); - - return err; + return g_test_run(); } |