diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-06 19:37:12 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-06 19:41:18 +0200 |
commit | 23188750272c89ce88e6944b43683f29be04affc (patch) | |
tree | d9fa779ceaea88832396ab3c64a97b4449552c69 | |
parent | 41f8fe4e55a3b0f2e471959374ba36314e19edc0 (diff) |
a
-rw-r--r-- | src/path-search-result.hpp | 2 | ||||
-rw-r--r-- | test/path-search-result.cpp | 23 |
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); } } |