summaryrefslogtreecommitdiffstats
path: root/tests/queue_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/queue_test.cpp')
-rw-r--r--tests/queue_test.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/tests/queue_test.cpp b/tests/queue_test.cpp
index c39d156..d299995 100644
--- a/tests/queue_test.cpp
+++ b/tests/queue_test.cpp
@@ -1,45 +1,48 @@
#include <iostream>
#include <string>
-#include "raul/Queue.h"
+#include "raul/SRSWQueue.h"
+#include "raul/SRMWQueue.h"
using std::string; using std::cerr; using std::cout; using std::endl;
int main()
{
- Queue<int> q(10);
+ //SRSWQueue<int> q(10);
+ SRMWQueue<int> q(10);
- cout << "New queue. Should be empty: " << q.is_empty() << endl;
+ cout << "New queue. Should be empty: " << q.empty() << endl;
cout << "Capacity: " << q.capacity() << endl;
- cout << "Fill: " << q.fill() << endl;
+ //cout << "Fill: " << q.fill() << endl;
for (uint i=0; i < 5; ++i) {
q.push(i);
- assert(!q.is_full());
+ assert(!q.full());
q.pop();
}
- cout << "Pushed and popped 5 elements. Queue should be empty: " << q.is_empty() << endl;
- cout << "Fill: " << q.fill() << endl;
+ cout << "Pushed and popped 5 elements. Queue should be empty: " << q.empty() << endl;
+ //cout << "Fill: " << q.fill() << endl;
for (uint i=10; i < 20; ++i) {
- q.push(i);
+ assert(q.push(i));
}
- cout << "Pushed 10 elements. Queue should be full: " << q.is_full() << endl;
- cout << "Fill: " << q.fill() << endl;
+ cout << "Pushed 10 elements. Queue should be full: " << q.full() << endl;
+ //cout << "Fill: " << q.fill() << endl;
cout << "The digits 10->19 should print: " << endl;
- while (!q.is_empty()) {
- int foo = q.pop();
+ while (!q.empty()) {
+ int foo = q.front();
+ q.pop();
cout << "Popped: " << foo << endl;
}
- cout << "Queue should be empty: " << q.is_empty() << endl;
- cout << "Fill: " << q.fill() << endl;
+ cout << "Queue should be empty: " << q.empty() << endl;
+ //cout << "Fill: " << q.fill() << endl;
cout << "Attempting to add eleven elements to queue of size 10. Only first 10 should succeed:" << endl;
for (uint i=20; i <= 39; ++i) {
cout << i;
- cout << " - Fill: " << q.fill();
- cout << ", is full: " << q.is_full();
+ //cout << " - Fill: " << q.fill();
+ cout << " - full: " << q.full();
cout << ", succeeded: " << q.push(i) << endl;
}