|
@@ -396,6 +396,29 @@ static void list_test_exec ( void ) {
|
396
|
396
|
ok ( list_first_entry ( list, struct list_test, list ) == NULL );
|
397
|
397
|
ok ( list_last_entry ( list, struct list_test, list ) == NULL );
|
398
|
398
|
|
|
399
|
+ /* Test list_next_entry() and list_prev_entry() */
|
|
400
|
+ INIT_LIST_HEAD ( list );
|
|
401
|
+ list_add_tail ( &list_tests[5].list, list );
|
|
402
|
+ list_add_tail ( &list_tests[3].list, list );
|
|
403
|
+ list_add_tail ( &list_tests[1].list, list );
|
|
404
|
+ list_add_tail ( &list_tests[7].list, list );
|
|
405
|
+ ok ( list_prev_entry ( &list_tests[5], list, list ) == NULL );
|
|
406
|
+ ok ( list_next_entry ( &list_tests[5], list, list ) == &list_tests[3] );
|
|
407
|
+ ok ( list_prev_entry ( &list_tests[3], list, list ) == &list_tests[5] );
|
|
408
|
+ ok ( list_next_entry ( &list_tests[3], list, list ) == &list_tests[1] );
|
|
409
|
+ ok ( list_prev_entry ( &list_tests[1], list, list ) == &list_tests[3] );
|
|
410
|
+ ok ( list_next_entry ( &list_tests[1], list, list ) == &list_tests[7] );
|
|
411
|
+ ok ( list_prev_entry ( &list_tests[7], list, list ) == &list_tests[1] );
|
|
412
|
+ ok ( list_next_entry ( &list_tests[7], list, list ) == NULL );
|
|
413
|
+ list_del ( &list_tests[7].list );
|
|
414
|
+ ok ( list_prev_entry ( &list_tests[1], list, list ) == &list_tests[3] );
|
|
415
|
+ ok ( list_next_entry ( &list_tests[1], list, list ) == NULL );
|
|
416
|
+ list_del ( &list_tests[3].list );
|
|
417
|
+ ok ( list_prev_entry ( &list_tests[5], list, list ) == NULL );
|
|
418
|
+ ok ( list_next_entry ( &list_tests[5], list, list ) == &list_tests[1] );
|
|
419
|
+ ok ( list_prev_entry ( &list_tests[1], list, list ) == &list_tests[5] );
|
|
420
|
+ ok ( list_next_entry ( &list_tests[1], list, list ) == NULL );
|
|
421
|
+
|
399
|
422
|
/* Test list_for_each() */
|
400
|
423
|
INIT_LIST_HEAD ( list );
|
401
|
424
|
list_add_tail ( &list_tests[6].list, list );
|