Fix mismatch of data types.

Separate checks.
This commit is contained in:
Filip Sykala 2022-05-06 13:37:35 +02:00
parent 9d2b6d5bda
commit 6ab517187f

View File

@ -343,7 +343,7 @@ TEST_CASE("Mutable priority queue - reshedule first", "[MutableSkipHeapPriorityQ
TEST_CASE("Mutable priority queue - first pop", "[MutableSkipHeapPriorityQueue]") TEST_CASE("Mutable priority queue - first pop", "[MutableSkipHeapPriorityQueue]")
{ {
struct MyValue{ struct MyValue{
int id; size_t id;
float val; float val;
}; };
size_t count = 50000; size_t count = 50000;
@ -356,15 +356,15 @@ TEST_CASE("Mutable priority queue - first pop", "[MutableSkipHeapPriorityQueue]"
[](MyValue &l, MyValue &r) { return l.val < r.val; }); [](MyValue &l, MyValue &r) { return l.val < r.val; });
q.reserve(count); q.reserve(count);
for (size_t id = 0; id < count; id++) { for (size_t id = 0; id < count; id++) {
MyValue mv; MyValue mv{ id, rand()};
mv.id = id;
mv.val = rand();
q.push(mv); q.push(mv);
} }
MyValue it = q.top(); // copy MyValue it = q.top(); // copy
q.pop(); q.pop();
bool valid = (it.id != 0) && (idxs[0] < 3 * count); // is valid id (no initial value default value)
CHECK(valid); CHECK(it.id != 0);
// is first item in queue valid value
CHECK(idxs[0] != std::numeric_limits<size_t>::max());
} }
TEST_CASE("Mutable priority queue complex", "[MutableSkipHeapPriorityQueue]") TEST_CASE("Mutable priority queue complex", "[MutableSkipHeapPriorityQueue]")