//---------------------Linked_List_main.cpp--------------------------
#include<iostream>
using namespace std;
#include"Linked_List.h"
int main()
{
cout<<"----------------------The program test is begin---------------------"<<endl;
cout<<endl;
//Routine test
List intList;//建立链表
cout<<"Constructing intList\n";
cout<<"List is empty? "<<boolalpha<<intList.empty()<<endl;//测试判空函数
cout<<"Display the intList's size:"<<intList.size()<<endl;//测试size函数
cout<<"---------------------------------------------------------------------"<<endl;
cout<<"Build ten nodes in the linked list "<<endl;//添加十个数据到链表
for(int i=0;i<10;i++){
intList.insert(10-i,i);
}
cout<<"Display the data in the linked list :";
intList.display(cout);//显示链表数据
cout<<"List is empty? "<<boolalpha<<intList.empty()<<endl;//再次测试判空函数
cout<<"Display to output the size:"<<intList.size()<<endl;//再次测试size函数
cout<<"The number in linked list is sorted from largest to smallest? "
<<boolalpha<<intList.is_LangeToSmall()<<endl;测试is_LangeToSmall函数
cout<<"----------------------------------------------------------------------"<<endl;
cout<<"Insert 2017 into the linked list"<<endl;
intList.insert(2017,7);//将2017插入链表,测试插入函数
cout<<"Display the data in the linked linked list :"<<endl;
intList.display(cout);//测试插入函数,是否插入到第7个节点之后的位置
cout<<"-----------------------------------------------------------------------"<<endl;
cout<<"The number in intList is sorted from largest to smallest? "
<<boolalpha<<intList.is_LangeToSmall()<<endl;//再次测试is_LangeToSmall函数
intList.reverse();//测试链表反转函数
cout<<"Display the data in the linked list after reversing the linked list:"<<endl;
intList.display(cout);//输出反转后的结果
cout<<endl;
cout<<"-----------------------------------------------------------------------"<<endl;
//Special value detection
/*以下一段代码主要测试一个节点条件下使用is_LangeToSmall()函数
reverse()函数以及insert()函数的情况*/
List intList1;
cout<<"Constructing intList1\n";
cout<<"Insert 2017 into the linked list1"<<endl;//测试insert()函数
intList1.insert(2017,0);
intList1.display(cout);
cout<<"The number in linked list1 is sorted from largest to smallest? "
<<boolalpha<<intList1.is_LangeToSmall()<<endl;//测试is_LangeToSmall()
intList1.reverse();//测试链表反转函数
cout<<"Display the data in the linked list after reversing the linked list:"<<endl;
intList1.display(cout);//输出反转后的结果
cout<<"----------------------The program test is end--------------------------"<<endl;
system("pause");
return 0;
}