diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dijkstra.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/dijkstra.cpp b/test/dijkstra.cpp index d34e28bf..c19a7fcb 100644 --- a/test/dijkstra.cpp +++ b/test/dijkstra.cpp @@ -1,5 +1,6 @@ #include "app.hpp" #include "path-search.hpp" +#include <chrono> namespace floormat { @@ -8,8 +9,18 @@ void test_app::test_dijkstra() auto w = world(); auto a = astar(); - a.Dijkstra(w, {}, 0, {{0, 0, 0}, {}}, {{1, 1, 0}, {}}, - 1*TILE_MAX_DIM*iTILE_SIZE2.x()); + using namespace std::chrono; + using clock = high_resolution_clock; + + const auto t0 = clock::now(); + + for (int i = 0; i < 10; i++) + { + a.Dijkstra(w, {}, 0, {{0, 0, 0}, {}}, {{1, 1, 0}, {}}, + 1*TILE_MAX_DIM*iTILE_SIZE2.x()); + } + const auto tm = clock::now() - t0; + Debug{} << "test took" << std::chrono::duration_cast<milliseconds>(tm).count() << "ms."; } } // namespace floormat |