测试用例如下:
#include <stdio.h>
#include <stdlib.h>
#include "SLinkList.h"
void Test1()//PushBack,PrintList,PopBack
{
SListNode*pHead=NULL;
PushBack(pHead, 1);
PushBack(pHead, 2);
PushBack(pHead, 3);
PushBack(pHead, 4);
PushBack(pHead, 5);
PrintList(pHead);
PopBack(pHead);
PopBack(pHead);
PrintList(pHead);
PopBack(pHead);
PopBack(pHead);
PopBack(pHead);
PrintList(pHead);
}
void Test2()//PushFront,Popfront
{
SListNode*pHead = NULL;
PushFront(pHead, 5);
PushFront(pHead, 4);
PushFront(pHead, 3);
PushFront(pHead, 2);
PushFront(pHead, 1);
PrintList(pHead);
PopFront(pHead);
PrintList(pHead);
PopFront(pHead);
PrintList(pHead);
PopFront(pHead);
PrintList(pHead);
PopFront(pHead);
PrintList(pHead);
PopFront(pHead);
PrintList(pHead);
PopFront(pHead);
PrintList(pHead);
}
void Test3()//Find,Insert
{
SListNode*pHead = NULL;
PushFront(pHead, 5);
PushFront(pHead, 4);
PushFront(pHead, 3);
PushFront(pHead, 2);
PushFront(pHead, 1);
Insert(pHead, 0);
pHead = Find(pHead, 3);
PrintList(pHead);
Insert(pHead, 4);
PrintList(pHead);
}
void Test4()//Erase
{
SListNode*pHead = NULL;
SListNode*tmp = NULL;
PushFront(pHead, 5);
PushFront(pHead, 4);
PushFront(pHead, 3);
PushFront(pHead, 2);
PushFront(pHead, 1);
tmp = Find(pHead, 5);
Erase(tmp);
PrintList(pHead);
}
void Test5()//ReveseList
{
SListNode*pHead = NULL;
PushBack(pHead, 1);
PushBack(pHead, 2);
PushBack(pHead, 3);
PushBack(pHead, 4);
PushBack(pHead, 5);
ReveseList(pHead);
PrintList(pHead);
}
void Test6()//FindLastposList
{
SListNode*pHead = NULL;
SListNode*ret = NULL;
PushBack(pHead, 1);
PushBack(pHead, 2);
PushBack(pHead, 3);
PushBack(pHead, 4);
PushBack(pHead, 5);
ret=FindListPosList(pHead, 2);
printf("%d ", ret->data);
ret = FindListPosList(pHead, 6);
printf("%d ", ret->data);
}
int main()
{
Test1();
Test2();
Test3();
Test4();
Test5();
Test6();
system("pause");
return 0;
}
  如有不足希望指正,有疑问希望提出