From ae90063afb7ddabcb505f8390b3b90bc7fea96ca Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Jan 2007 04:07:53 +0000 Subject: Added atomic int/pointer classes to Raul. Added multi-writer queue to Raul. Renamed Queue SRSWQueue (single-reader single-writer). Updated patchage/ingen for Raul changes. git-svn-id: http://svn.drobilla.net/lad/raul@264 a436a847-0d15-0410-975c-d299462d15a1 --- tests/queue_test.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'tests/queue_test.cpp') 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 #include -#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 q(10); + //SRSWQueue q(10); + SRMWQueue 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; } -- cgit v1.2.1