From dd00820933be56fbe3ef2b296a5b59b7f78316ca Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 9 Oct 2023 10:06:54 +0200 Subject: a --- test/dijkstra.cpp | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'test/dijkstra.cpp') diff --git a/test/dijkstra.cpp b/test/dijkstra.cpp index 8b56e505..8c35648d 100644 --- a/test/dijkstra.cpp +++ b/test/dijkstra.cpp @@ -1,36 +1,11 @@ #include "app.hpp" +#include "bench.hpp" #include "src/path-search.hpp" #include "loader/loader.hpp" #include -#include -#include namespace floormat { -namespace { - -template -requires requires (F& fun) { fun(); } -void bench_run(StringView name, F&& fun) -{ - using namespace std::chrono; - using clock = high_resolution_clock; -#if 0 - for (int i = 0; i < 20; i++) - fun(); - const auto t0 = clock::now(); - for (int i = 0; i < 1000; i++) - fun(); -#else - const auto t0 = clock::now(); - fun(); -#endif - const auto tm = clock::now() - t0; - Debug{} << "test" << name << "took" << duration_cast(tm).count() << "ms."; -} - -} // namespace - void test_app::test_dijkstra() { auto w = world(); @@ -58,6 +33,15 @@ void test_app::test_dijkstra() fm_assert(ch.is_passability_modified()); + auto do_bench = [&](int debug) { + a.Dijkstra(w, + {{0,0,0}, {11,9}}, // from + {wpos, {wox, woy}}, // to + 0, max_dist, {32,32}, // size + debug); + }; + + //do_bench(0); bench_run("Dijkstra", [&] { a.Dijkstra(w, {{0,0,0}, {11,9}}, // from -- cgit v1.2.3