static size_t s_nRigtorpSPSCQueueEnqueueStride;
static size_t s_nRigtorpSPSCQueueCapacity;
+ rigtorp::SPSCQueue<size_t>* q;
+
static void SetUpTestCase() {
cds_test::config const &cfg = get_config("SequentialMisc");
GetConfigExpected(RigtorpSPSCQueuePassCount, 10000);
}
void test() {
- rigtorp::SPSCQueue<size_t> q(s_nRigtorpSPSCQueueCapacity);
+ std::unique_ptr<rigtorp::SPSCQueue<size_t>> q(
+ new rigtorp::SPSCQueue<size_t>(s_nRigtorpSPSCQueueCapacity));
size_t nNo = 0;
size_t push_sum = 0;
size_t pop_sum = 0;
size_t curr_push_count = std::min(s_nRigtorpSPSCQueuePassCount - nNo,
s_nRigtorpSPSCQueueEnqueueStride);
for (size_t i = 0; i < curr_push_count; i++) {
- q.push(nNo);
+ q->push(nNo);
push_sum += nNo;
++nNo;
}
size_t* res = nullptr;
- while ((res = q.front())) {
+ while ((res = q->front())) {
pop_sum += *res;
- q.pop();
+ q->pop();
}
EXPECT_EQ(pop_sum, push_sum);
push_sum = 0;