mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
optimize test performance
This commit is contained in:
parent
daae701cec
commit
526f63943f
@ -48,6 +48,7 @@ void Unit::test_producer(void) {
|
|||||||
auto disconn = [](cq_t* cq) { cq->disconnect(); };
|
auto disconn = [](cq_t* cq) { cq->disconnect(); };
|
||||||
std::unique_ptr<cq_t, decltype(disconn)> guard(cq__, disconn);
|
std::unique_ptr<cq_t, decltype(disconn)> guard(cq__, disconn);
|
||||||
|
|
||||||
|
std::vector<int> list;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
do {
|
do {
|
||||||
while (cur != cq__->cursor()) {
|
while (cur != cq__->cursor()) {
|
||||||
@ -55,9 +56,13 @@ void Unit::test_producer(void) {
|
|||||||
cq__->commit(cur);
|
cq__->commit(cur);
|
||||||
if (d < 0) return;
|
if (d < 0) return;
|
||||||
cur = cq__->next(cur);
|
cur = cq__->next(cur);
|
||||||
|
list.push_back(d);
|
||||||
|
}
|
||||||
|
for (int d : list) {
|
||||||
QCOMPARE(i, d);
|
QCOMPARE(i, d);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
list.clear();
|
||||||
} while(1);
|
} while(1);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user