blob: 1ff90ad81ea29788ec799a6e045fe8ee6c4b98b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "app.hpp"
#include "compat/assert.hpp"
#include "src/search-result.hpp"
#include "src/search-node.hpp"
namespace floormat {
void test_app::test_astar_pool()
{
auto& pool = path_search_result::_pool;
fm_assert(!pool);
{
auto a = path_search_result{};
fm_assert(!pool);
}
fm_assert(pool);
auto* pool2 = pool.get();
{
auto b = path_search_result{};
fm_assert(b._node.get() == pool2);
auto c = path_search_result{};
fm_assert(!pool);
fm_assert(c._node.get() != pool2);
fm_assert(b._node.get() == pool2);
fm_assert(!b._node->_next);
fm_assert(!c._node->_next);
}
{
auto count = 0uz;
for (const auto* ptr = pool.get(); ptr; ptr = ptr->_next.get())
count++;
fm_assert(count == 2);
}
}
} // namespace floormat
|