2020-01-17 07:21:12 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include "queue.cpp"
|
2020-05-30 07:26:30 +08:00
|
|
|
#include "queue.h"
|
2020-01-17 07:21:12 +08:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
queue<string> q;
|
2020-05-30 07:26:30 +08:00
|
|
|
cout << "---------------------- Test construct ----------------------"
|
|
|
|
<< endl;
|
2020-01-17 07:21:12 +08:00
|
|
|
q.display();
|
2020-05-30 07:26:30 +08:00
|
|
|
cout << "---------------------- Test isEmptyQueue ----------------------"
|
|
|
|
<< endl;
|
|
|
|
if (q.isEmptyQueue())
|
|
|
|
cout << "PASS" << endl;
|
2020-01-17 07:21:12 +08:00
|
|
|
else
|
2020-05-30 07:26:30 +08:00
|
|
|
cout << "FAIL" << endl;
|
|
|
|
cout << "---------------------- Test enQueue ----------------------"
|
|
|
|
<< endl;
|
|
|
|
cout << "After Hai, Jeff, Tom, Jkingston go into queue: " << endl;
|
2020-01-17 07:21:12 +08:00
|
|
|
q.enQueue("Hai");
|
|
|
|
q.enQueue("Jeff");
|
|
|
|
q.enQueue("Tom");
|
|
|
|
q.enQueue("Jkingston");
|
|
|
|
q.display();
|
|
|
|
cout << "---------------------- Test front ----------------------" << endl;
|
|
|
|
string value = q.front();
|
|
|
|
if (value == "Hai")
|
2020-05-30 07:26:30 +08:00
|
|
|
cout << "PASS" << endl;
|
2020-01-17 07:21:12 +08:00
|
|
|
else
|
2020-05-30 07:26:30 +08:00
|
|
|
cout << "FAIL" << endl;
|
|
|
|
cout << "---------------------- Test deQueue ----------------------"
|
|
|
|
<< endl;
|
2020-01-17 07:21:12 +08:00
|
|
|
q.display();
|
|
|
|
q.deQueue();
|
|
|
|
q.deQueue();
|
2020-05-30 07:26:30 +08:00
|
|
|
cout << "After Hai, Jeff left the queue: " << endl;
|
2020-01-17 07:21:12 +08:00
|
|
|
q.display();
|
|
|
|
return 0;
|
|
|
|
}
|