-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtester.cpp
46 lines (38 loc) · 825 Bytes
/
tester.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
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include "priority_queue.h"
using namespace std;
void testRandom(const int SZ)
{
PriorityQueue<size_t> queue;
srand(225);
vector<size_t> vals;
for(size_t i = 0; i < SZ; ++i)
vals.push_back(i);
std::random_shuffle(vals.begin(), vals.end());
for(size_t i = 0; i < SZ; ++i)
queue.insert(vals[i]);
for(size_t i = 0; i < SZ; ++i)
{
cout << "pop: " << queue.pop() << endl;
}
}
void testDupes()
{
PriorityQueue<int> queue;
for(size_t i = 0; i < 20; ++i)
{
queue.insert(2);
}
while (!queue.isEmpty())
{
cout << "pop: " << queue.pop() << endl;
}
}
int main(int argc, char* argv[])
{
testDupes();
return 0;
}