summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/path-search-result.hpp2
-rw-r--r--test/path-search-result.cpp23
2 files changed, 18 insertions, 7 deletions
diff --git a/src/path-search-result.hpp b/src/path-search-result.hpp
index ea00cd85..fcd116fc 100644
--- a/src/path-search-result.hpp
+++ b/src/path-search-result.hpp
@@ -1,5 +1,6 @@
#pragma once
#include "src/global-coords.hpp"
+#include "compat/defs.hpp"
#include <memory>
#include <vector>
@@ -27,6 +28,7 @@ private:
struct node
{
friend struct path_search_result;
+ friend struct test_app;
node() noexcept;
fm_DECLARE_DELETED_COPY_ASSIGNMENT(node);
diff --git a/test/path-search-result.cpp b/test/path-search-result.cpp
index 1d464e8c..427de52a 100644
--- a/test/path-search-result.cpp
+++ b/test/path-search-result.cpp
@@ -7,19 +7,28 @@ namespace floormat {
void test_app::test_path_search_node_pool()
{
auto& pool = path_search_result::_pool;
- fm_debug_assert(!pool);
+ fm_assert(!pool);
{
auto a = path_search_result{};
- fm_debug_assert(!pool);
+ fm_assert(!pool);
}
- fm_debug_assert(pool);
+ fm_assert(pool);
+ auto* pool2 = pool.get();
{
- auto* pool2 = pool.get();
auto b = path_search_result{};
- fm_debug_assert(b._node.get() == pool2);
+ fm_assert(b._node.get() == pool2);
auto c = path_search_result{};
- fm_debug_assert(c._node.get() != pool2);
- fm_debug_assert(b._node.get() == pool2);
+ 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);
}
}