Пример #1
0
END_TEST

START_TEST(linkedlist_recount_test)
{
#line 90
      LinkedList *crap0 = create_linkedlist_range(1,100);
      ck_assert(100 == linkedlist_recount(crap0));
      free_linkedlist(crap0);


}
Пример #2
0
END_TEST

START_TEST(create_linkedlist_range_test)
{
#line 79
      LinkedList *crap0 = create_linkedlist_range(0, 1000);
      ck_assert(crap0 != NULL);
      int i;
      LinkedListData *listhead = crap0->first;
      for(i = 0; i <= 1000; i++){
      	    int test = *((int *) listhead->data);
	    ck_assert(i == test);	    
	    listhead = listhead->next;
      }
      free_linkedlist(crap0);
}
Пример #3
0
END_TEST

START_TEST(linkedlist_index)
{
#line 64
  LinkedList *crap0 = create_linkedlist();
  int i;
  for(i = 0; i < 1000; i++){
    append_to_linkedlist(crap0, (void *) &i, sizeof(int));
  }
  int a;
  for( a = 0; a < 1000; a++){
    if(a < 1000){
      int *b = (int *) get_index_data_linkedlist(crap0, a);
      ck_assert(a == *b);
    }
  }
  free_linkedlist(crap0);
      
}
Пример #4
0
END_TEST

START_TEST(get_index_range_linkedlist_test)
{
#line 96
      LinkedList *crap0 = create_linkedlist_range(0,1000);
      int three_itter = 0;
      for(three_itter = 0; three_itter <= 1000-3; three_itter++){
      		      LinkedList *three = get_index_range_linkedlist(crap0, three_itter, three_itter+3);
		      int i;
		      for(i = 0; i < 3; i++){
		      	    ///WE COULD WRITE A F*****G MAP FUNCTION
			    //we will need a linkedlist data that doesn't malloc or copy!!!!!!
		      }
      


      }  
      free_linkedlist(crap0);


      

}
Пример #5
0
/*
 * 作者:玩命
 * 开始日期:2009-1-1
 * 完成日期:2009-1-1
 * 参数:
 *    pll:指向链表指针的指针.
 * 返回值:
 *    无.
 * 说明:
 *    释放一条链表.
 */
void free_linkedlist(PLINKEDLIST_NODE *pll) {
	assert(pll);
	if ((*pll)->next) free_linkedlist(&((*pll)->next));
	logic_free(*pll);*pll = NULL;
	return;
}/* end free_linkedlist */