@@ -430,6 +430,29 @@ int test_linked_list()
430
430
if (pArr [5 ] != NULL ) result ++ ;
431
431
test_msg_end (result );
432
432
433
+ test_msg_start ("Test Linked List - Search List" );
434
+ list_clear (test_list1 );
435
+ if (list_search (test_list1 , test_node1 ) != 0 ) result ++ ;
436
+ test_node1 = list_ins_head (test_list1 );
437
+ if (list_search (test_list1 , test_node1 ) != 1 ) result ++ ;
438
+ if (list_search (test_list1 , test_node2 ) != 0 ) result ++ ;
439
+ if (list_search (test_list1 , test_node3 ) != 0 ) result ++ ;
440
+ if (list_search (test_list1 , NULL ) != 0 ) result ++ ;
441
+ if (list_search (test_list1 , (List_Node * )test_list1 ) != 0 ) result ++ ;
442
+ test_node2 = list_ins_head (test_list1 );
443
+ if (list_search (test_list1 , test_node1 ) != 1 ) result ++ ;
444
+ if (list_search (test_list1 , test_node2 ) != 1 ) result ++ ;
445
+ if (list_search (test_list1 , test_node3 ) != 0 ) result ++ ;
446
+ if (list_search (test_list1 , NULL ) != 0 ) result ++ ;
447
+ if (list_search (test_list1 , (List_Node * )test_list1 ) != 0 ) result ++ ;
448
+ list_clear (test_list1 );
449
+ if (list_search (test_list1 , test_node1 ) != 0 ) result ++ ;
450
+ if (list_search (test_list1 , test_node2 ) != 0 ) result ++ ;
451
+ if (list_search (test_list1 , test_node3 ) != 0 ) result ++ ;
452
+ if (list_search (test_list1 , NULL ) != 0 ) result ++ ;
453
+ if (list_search (test_list1 , (List_Node * )test_list1 ) != 0 ) result ++ ;
454
+ test_msg_end (result );
455
+
433
456
return result ;
434
457
}
435
458
0 commit comments