forked from KirollosEMH/Video_Player_Data_Structures
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
159 lines (134 loc) · 5.01 KB
/
main.cpp
File metadata and controls
159 lines (134 loc) · 5.01 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include "CircularLinkedList/CircularLinkedList.hpp"
#include "VideoPlayer/VideoPlayer.h"
#include<opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
//#define CIRCULAR_TEST
int main(){
#ifdef CIRCULAR_TEST
// default constructor test
CircularLinkedList<int> list1;
// insert test
list1.insert(1, 0);
list1.insert(2, 1);
list1.insert(3, 2);
list1.insert(4, 3);
cout << "list1 after insert: " << endl;
list1.display(cout);
cout << "=============================" << endl;
// copy constructor test
CircularLinkedList<int> list2(list1);
cout << "list2 after copy constructor: " << endl;
list2.display(cout);
cout << "=============================" << endl;
// assignment operator test
CircularLinkedList<int> list3, list4, list5;
list3 = list1;
cout << "list3 after assignment operator: " << endl;
list3.display(cout);
cout << "=============================" << endl;
// erase test
cout << "list3 before erasing index(0): " << endl;
list3.display(cout);
list3.erase(0);
cout << "list3 after erasing index(0): " << endl;
list3.display(cout);
cout << "=============================" << endl;
// erase test exception
cout << "list3 before erasing index(125): " << endl;
list3.display(cout);
list3.erase(125);
cout << "list3 after erasing index(125): " << endl;
list3.display(cout);
cout << "=============================" << endl;
// assignment operator test
list4 = list5 = list3;
cout << "list4 after assignment operator: " << endl;
list4.display(cout);
cout << "list5 after assignment operator: " << endl;
list5.display(cout);
cout << "=============================" << endl;
// search test
cout << "Index of 3 in list3: " << list3.search(3) << endl;
// search test exception
cout << "Index of 125 in list3: " << list3.search(125) << endl;
cout << "=============================" << endl;
// organizeBySwap test
cout << "list3 before organizeBySwap (value of 3 to position 0): " << endl;
list3.display(cout);
cout << "list3 after organizeBySwap (value of 3 to position 0): " << endl;
list3.organizeBySwap(3,0);
list3.display(cout);
cout << "=============================" << endl;
// organizeByShift test
cout << "list3 before organizeByShift (value of 4 to position 0): " << endl;
list3.display(cout);
cout << "list3 after organizeByShift (value of 4 to position 0): " << endl;
list3.organizeByShift(4,0);
list3.display(cout);
cout << "=============================" << endl;
// organizeBySwap test exception
cout << "list3 before organizeBySwap exception (value of 3 to position -1): " << endl;
list3.display(cout);
cout << "list3 after organizeBySwap exception (value of 3 to position -1): " << endl;
list3.organizeBySwap(3,-1);
list3.display(cout);
cout << "=============================" << endl;
// organizeByShift test exception
cout << "list3 before organizeByShift exception (value of 3 to position 3): " << endl;
list3.display(cout);
cout << "list3 after organizeByShift exception (value of 3 to position 3): " << endl;
list3.organizeByShift(3,3);
list3.display(cout);
cout << "=============================" << endl;
// size test
cout << "Size of list3: " << list3.getSize() << endl;
cout << "=============================" << endl;
// clear test
cout << "list3 before clear: " << endl;
list3.display(cout);
list3.clear();
cout << "list3 after clear: " << endl;
list3.display(cout);
cout << "=============================" << endl;
string str = (list3.empty())? "Yes":"No";
// empty test
cout << "list3 empty? " << str << endl;
cout << "=============================" << endl;
cout << "list2 after Copy Constructor: " << endl;
list2.display(cout);
cout << "=============================" << endl;
// destructor test
list1.~CircularLinkedList();
// getCurrent test
cout << "list2: " << endl;
list2.display(cout);
cout << "list2 current data: ";
cout << list2.getCurrentData() << endl;
cout << "=============================" << endl;
// rotateNext test
cout << "list2 current data after rotateNext: ";
list2.rotateNext();
cout << list2.getCurrentData() << endl;
cout << "=============================" << endl;
// rotatePrev test
cout << "list2 current data after rotatePrev: ";
list2.rotatePrevious();
cout << list2.getCurrentData() << endl;
cout << "=============================" << endl;
// creating a list of another type
cout << "Creating a list of another type:" << endl;
CircularLinkedList<string> list6;
list6.insert("Hello", 0);
list6.insert("World", 1);
list6.insert("!", 2);
cout << "list6 of string type: " << endl;
list6.display(cout);
cout << "=============================" << endl;
#else
VideoPlayer videoPlayer;
videoPlayer.VideoPlayerMainMenu();
return 0;
#endif
}