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.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/queue_test.cpp b/tests/queue_test.cpp
index 7a1d44b..1e92104 100644
--- a/tests/queue_test.cpp
+++ b/tests/queue_test.cpp
@@ -120,6 +120,33 @@ int main()
{
unsigned long total_processed = 0;
+ cout << "Testing size" << endl;
+ for (unsigned i=0; i < queue.capacity(); ++i) {
+ queue.push(i);
+ if (i == queue.capacity()-1) {
+ if (!queue.full()) {
+ cerr << "ERROR: Should be full at " << i
+ << " (size " << queue.capacity() << ")" << endl;
+ return -1;
+ }
+ } else {
+ if (queue.full()) {
+ cerr << "ERROR: Prematurely full at " << i
+ << " (size " << queue.capacity() << ")" << endl;
+ return -1;
+ }
+ }
+ }
+
+ for (unsigned i=0; i < queue.capacity(); ++i)
+ queue.pop();
+
+ if (!queue.empty()) {
+ cerr << "ERROR: Should be empty" << endl;
+ return -1;
+ }
+
+ cout << "Testing concurrent reading/writing" << endl;
vector<WriteThread*> writers(NUM_WRITERS, new WriteThread());
struct termios orig_term;