-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetTester.cpp
87 lines (71 loc) · 1.82 KB
/
SetTester.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
#include "Set.h"
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
Set *set = new Set();
set->add("blinky");
set->add("pinky");
set->add("clyde");
cout <<"after first 3 adds size: " << set->getSize()<< endl;
set->display();
cout << endl;
set->add("blinky");
cout <<"after add of duplicate size: " << set->getSize()<< endl;
set->display();
cout << endl;
string d = "blinky";
if(set->contains(d)){
cout <<"set contains " << d<< endl;
}
else{
cout <<"set does not contain" << d<< endl;
}
d = "inky";
if(set->contains(d)){
cout <<"set contains " << d<< endl;
}
else{
cout <<"set does not contain " << d<< endl;
}
cout << endl;
bool result = set->remove("scooby");
cout <<"result of remove of entry not in list " << result<< endl;
set->display();
cout <<"Size: " << set->getSize()<< endl;
cout << endl;
result = set->remove("blinky");
cout <<"result of remove of blinky " << result<< endl;
set->display();
cout <<"Size: " << set->getSize()<< endl;
cout << endl;
d = "blinky";
if(set->contains(d)){
cout <<"set contains " << d<< endl;
}
else{
cout <<"set does not contain " << d<< endl;
}
result = set->remove("pinky");
cout <<"result of remove of pinky " << result<< endl;
set->display();
cout <<"Size: " << set->getSize() << endl;
cout << endl;
set->clear();
cout <<"after clear "<< endl;
set->display();
cout <<"Size: " << set->getSize() << endl;
cout << endl;
d = "clyde";
if(set->contains(d)){
cout <<"set contains " << d<< endl;
}
else{
cout <<"set does not contain " << d<< endl;
}
cout <<"set is empty? " << set->isEmpty()<< endl;
set->add("goofy");
cout <<"after add of goofy size: " << set->getSize()<< endl;
set->display();
cout << endl;
}