-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutPod_driver.cpp
186 lines (128 loc) · 4.05 KB
/
utPod_driver.cpp
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* utPod_driver.cpp
Demo Driver for the UtPod.
Roger Priebe
EE 312 10/16/18
This is a basic driver for the UtPod.
You will want to do more complete testing.
Edited by: David Fernandez and Adrian Melo
*/
#include <cstdlib>
#include <iostream>
#include "Song.h"
#include "UtPod.h"
using namespace std;
int main(int argc, char *argv[]) {
/*
// SONG TESTER //
Song s("Beatles", "Hey Jude", 5);
Song s2("Beatles", "Hey Jude", 4);
Song s3("A", "Hey Jude", 5);
Song s4("AABB", "Hey Jude", 5);
Song s5("Beatles", "Hey Jude", 5);
Song s6("Beatles", "Hey Jude2", 5);
Song s7("A", "Hey Jude", 5);
Song s8("A", "Hey Jude", 5);
if (s4 > s3) { //Expected False
cout << "Operator greater than artist Works" << endl;
} else {
cout << "'>' operator artist didn't work" << endl;
}
if (s6 > s5) { //Expected False
cout << "Operator greater than title Works" << endl;
} else {
cout << "'>' operator title didn't work" << endl;
}
if (s2 > s) { //Expected False
cout << "Operator greater than size compare Works" << endl;
} else {
cout << "'>' operator size compare didn't work" << endl;
}
if (s8 > s7) { //Expected to print "didn't work"
cout << "Operator greater than didn't work" << endl;
} else {
cout << "'>' operator greater than works" << endl;
}
if (s3 < s4) { //Expected False
cout << "Operator '<' artist Works" << endl;
} else {
cout << "'>' operator artist didn't work" << endl;
}
if (s5 < s6) { //Expected False
cout << "Operator '<' title Works" << endl;
} else {
cout << "'>' operator title didn't work" << endl;
}
if (s < s2) { //Expected False
cout << "Operator '<' size compare Works" << endl;
} else {
cout << "'<' operator size compare didn't work" << endl;
}
if (s7 < s8) { //Expected "didn't work"
cout << "Operator '<' didn't work" << endl;
} else {
cout << "Operator '<' works" << endl;
}
if (s8 == s7) { //Expected True
cout << "Operator '==' works" << endl;
} else {
cout << "Operator '==' incorrect" << endl;
}
if (s2 == s) { //Expected False
cout << "Operator '==' incorrect" << endl;
} else {
cout << "Operator '==' works" << endl;
}
}
*/
for(int i = 0; i<40; i++){
}
UtPod t;
UtPod t2(256);
Song s1("Beatles", "Hey Jude1", 4);
int result = t.addSong(s1);
cout << "result = " << result << endl;
t.showSongList();
Song s2("Beatles", "Hey Jude2", 5);
result = t.addSong(s2);
cout << "result = " << result << endl;
if (s1 < s2) { //Expected False
cout << "Operator '<' size compare Works" << endl;
} else {
cout << "'<' operator size compare didn't work" << endl;
}
t.showSongList();
Song s3("Beatles", "Hey Jude3", 6);
result = t.addSong(s3);
cout << "result = " << result << endl;
Song s4("Beatles", "Hey Jude4", 7);
result = t.addSong(s4);
cout << "result = " << result << endl;
Song s5("Beatles", "Hey Jude5", 241);
result = t.addSong(s5);
cout << "add result = " << result << endl;
t.shuffle();
cout << "SHUFFLED"<< endl;
t.showSongList();
t.sortSongList();
cout << "SORTED"<< endl;
t.showSongList();
result = t.removeSong(s2);
cout << "delete result = " << result << endl;
result = t.removeSong(s3);
cout << "delete result = " << result << endl;
t.showSongList();
result = t.removeSong(s1);
cout << "delete result = " << result << endl;
result = t.removeSong(s5);
cout << "delete result = " << result << endl;
result = t.removeSong(s4);
cout << "delete result = " << result << endl;
t.showSongList();
result = t.addSong(s5);
cout << "add result = " << result << endl;
t.showSongList();
cout << "memory = " << t.getRemainingMemory() << endl;
t.clearMemory();
cout << "memory = " << t.getRemainingMemory() << endl;
t.showSongList();
}