summaryrefslogtreecommitdiff
path: root/src/tests/eina_test_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/eina_test_list.c')
-rw-r--r--src/tests/eina_test_list.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tests/eina_test_list.c b/src/tests/eina_test_list.c
index 6e08847..ce70d03 100644
--- a/src/tests/eina_test_list.c
+++ b/src/tests/eina_test_list.c
@@ -338,10 +338,50 @@ START_TEST(eina_test_sorted_insert)
338} 338}
339END_TEST 339END_TEST
340 340
341START_TEST(eina_test_list_split)
342{
343 Eina_List *left = NULL, *right = NULL ;
344 Eina_List *list = NULL;
345 Eina_List *l;
346 void *list_data;
347 int i;
348
349 eina_init();
350
351 list = eina_list_append(list, "tigh");
352 list = eina_list_append(list, "adar");
353 list = eina_list_append(list, "baltar");
354 list = eina_list_append(list, "roslin");
355 list = eina_list_append(list, "baltar");
356 list = eina_list_append(list, "roslin");
357 list = eina_list_append(list, "baltar");
358 list = eina_list_append(list, "roslin");
359
360 fail_if(list == NULL);
361 fail_if(eina_list_count(list) != 8);
362
363 for ( i = 0; i < 200; i++)
364 {
365 left = eina_list_split_list(list, eina_list_nth_list(list, i % 2), &right);
366
367 if (i % 2 == 0)
368 fail_if(eina_list_count(left) == 1 && eina_list_count(right) + eina_list_count(left) == i + 7);
369 else
370 fail_if(eina_list_count(left) == 2 && eina_list_count(right) + eina_list_count(left) == i + 7);
371
372 list = eina_list_merge(left, right);
373 list = eina_list_append(list, "roslin");
374 }
375
376 eina_shutdown();
377}
378END_TEST
379
341void 380void
342eina_test_list(TCase *tc) 381eina_test_list(TCase *tc)
343{ 382{
344 tcase_add_test(tc, eina_test_simple); 383 tcase_add_test(tc, eina_test_simple);
345 tcase_add_test(tc, eina_test_merge); 384 tcase_add_test(tc, eina_test_merge);
346 tcase_add_test(tc, eina_test_sorted_insert); 385 tcase_add_test(tc, eina_test_sorted_insert);
386 tcase_add_test(tc, eina_test_list_split);
347} 387}