diff options
author | David Robillard <d@drobilla.net> | 2007-01-22 04:07:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-22 04:07:53 +0000 |
commit | ae90063afb7ddabcb505f8390b3b90bc7fea96ca (patch) | |
tree | 361c26eed5293d70ce662549172533967e7b48de /tests | |
parent | ca32b189529ffc7c1d42af85f005dea54189218f (diff) | |
download | raul-ae90063afb7ddabcb505f8390b3b90bc7fea96ca.tar.gz raul-ae90063afb7ddabcb505f8390b3b90bc7fea96ca.tar.bz2 raul-ae90063afb7ddabcb505f8390b3b90bc7fea96ca.zip |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/queue_test.cpp | 35 |
2 files changed, 24 insertions, 19 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 20209d3..9fba352 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,16 +1,18 @@ if BUILD_TESTS -AM_CXXFLAGS = -I.. -lpthread @RASQAL_CFLAGS@ -ALL_LIBS = @RASQAL_LIBS@ ../src/libraul.la +AM_CXXFLAGS = -I.. -lpthread @RASQAL_CFLAGS@ @GLIBMM_CFLAGS@ +ALL_LIBS = @RASQAL_LIBS@ @GLIBMM_LIBS@ ../src/libraul.la -bin_PROGRAMS = path_test thread_test queue_test +bin_PROGRAMS = path_test thread_test queue_test atomic_test thread_test_LDADD = $(ALL_LIBS) path_test_LDADD = $(ALL_LIBS) queue_test_LDADD = $(ALL_LIBS) +atomic_test_LDADD = $(ALL_LIBS) path_test_SOURCES = path_test.cpp thread_test_SOURCES = thread_test.cpp queue_test_SOURCES = queue_test.cpp +atomic_test_SOURCES = atomic_test.cpp endif 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; } |