1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
//测试文件
#include <iostream>
#include "../Class_Example.h"
#include "LinkedList_simplified.h"
using namespace std;
int main(int argc, char const *argv[])
{
const int listcap = 5;
Player playerlist[listcap] =
{
Player(1, "Cookiezi"),
Player(2, "WhiteWolf"),
Player(3, "rrtyui"),
Player(4, "powergame"),
Player(5, "SiLviA"),
};
LinkedList<Player> players;
cout << "-----------insert test-----------" <<endl;
for (int i = 0; i < listcap; ++i)
{
players.insert(players.size() - 1, playerlist[i]);
}
for (int i = 0; i < listcap; ++i)
{
cout << players.index(i+1).getname() << ", " << endl;
}
cout << "-----------copy test-----------" <<endl;
LinkedList<Player> players_copy_1 = players;
for (int i = 0; i < listcap; ++i)
{
cout << players_copy_1.index(i+1).getname() << ", " << endl;
}
cout << "-----------operator= test-----------" <<endl;
LinkedList<Player> players_copy_2;
players_copy_2 = players_copy_1;
for (int i = 0; i < listcap; ++i)
{
cout << players_copy_2.index(i+1).getname() << ", " << endl;
}
return 0;
}
|