+ if (Pop) {
+ consumerPop();
+ } else {
+ consumerRead();
+ }
+ }
+
+ void consumerPop() {
+ for (auto expect : testData_) {
+ again:
+ T* data;
+ if (!(data = queue_.frontPtr())) {
+ if (done_) {
+ // Try one more read; unless there's a bug in the queue class
+ // there should still be more data sitting in the queue even
+ // though the producer thread exited.
+ if (!(data = queue_.frontPtr())) {
+ EXPECT_TRUE(0 && "Finished too early ...");
+ return;
+ }
+ } else {
+ goto again;
+ }
+ } else {
+ queue_.popFront();
+ }
+
+ EXPECT_EQ(*data, expect);
+ }
+ }
+
+ void consumerRead() {
+ for (auto expect : testData_) {