Extend unit test
This commit is contained in:
parent
38f83730c3
commit
413036a097
@ -76,11 +76,6 @@ void TestKdTree::singleUpdate() {
|
||||
}
|
||||
}
|
||||
|
||||
// 1: asan again
|
||||
// 2: asan again
|
||||
// 3: violates assert
|
||||
// 5: violates asan
|
||||
|
||||
void TestKdTree::randomOps() {
|
||||
PseudoRandom pr(814538);
|
||||
|
||||
@ -100,8 +95,7 @@ void TestKdTree::randomOps() {
|
||||
kds.insert(point, id);
|
||||
}
|
||||
|
||||
const auto testRandomQueries = [&]() {
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
const auto testRandomQuery = [&]() {
|
||||
std::array<f32, 3> min, max;
|
||||
for (uint8_t d = 0; d < 3; ++d) {
|
||||
min[d] = pr.range(-1500, 1500);
|
||||
@ -117,6 +111,11 @@ void TestKdTree::randomOps() {
|
||||
expected_ids.erase(id);
|
||||
});
|
||||
UASSERT(expected_ids.empty());
|
||||
};
|
||||
|
||||
const auto testRandomQueries = [&]() {
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
testRandomQuery();
|
||||
}
|
||||
};
|
||||
|
||||
@ -136,4 +135,11 @@ void TestKdTree::randomOps() {
|
||||
}
|
||||
|
||||
testRandomQueries();
|
||||
|
||||
// Finally, empty the structure(s)
|
||||
for (u16 id = 800; id < 1000; ++id) {
|
||||
objvec.remove(id);
|
||||
kds.remove(id);
|
||||
testRandomQuery();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user