File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 3.10 )
1+ cmake_minimum_required (VERSION 3.20 )
22project (astar-algorithm-cpp)
33
44set (CMAKE_CXX_STANDARD 11)
55set (CMAKE_CXX_STANDARD_REQUIRED True )
66
7- # Header-only library interface (optional but good practice)
7+ include (FetchContent )
8+ FetchContent_Declare (
9+ doctest
10+ URL https://raw.githubusercontent.com/doctest/doctest/v2.4.11/doctest/doctest.h
11+ DOWNLOAD_NO_EXTRACT TRUE
12+ )
13+ FetchContent_MakeAvailable (doctest)
14+
15+ add_library (doctest INTERFACE )
16+ target_include_directories (doctest INTERFACE ${doctest_SOURCE_DIR } )
17+
18+ # Header-only library interface
819add_library (stlastar INTERFACE )
920target_include_directories (stlastar INTERFACE ${CMAKE_CURRENT_SOURCE_DIR } )
1021
11- # Executables
1222add_executable (8puzzle 8puzzle.cpp )
1323target_link_libraries (8puzzle stlastar )
1424
@@ -18,8 +28,10 @@ target_link_libraries(findpath stlastar)
1828add_executable (minpathbucharest min_path_to_Bucharest.cpp )
1929target_link_libraries (minpathbucharest stlastar )
2030
21- # Tests
2231enable_testing ()
2332add_executable (tests tests.cpp )
24- target_link_libraries (tests stlastar )
33+
34+ target_link_libraries (tests stlastar doctest )
35+
36+ # Register with CTest so you can run 'ctest' in the build folder
2537add_test (NAME tests COMMAND tests )
Original file line number Diff line number Diff line change 11// A unit test suite
22
3+ #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
4+ #include " doctest.h"
5+ #include " stlastar.h" // Assuming this is your header
6+
7+ TEST_CASE (" Test A* Basic Functionality" ) {
8+ // Your test logic here
9+ CHECK (1 + 1 == 2 );
10+ }
311#include < assert.h>
412#include < stdio.h>
513#include < stdlib.h>
@@ -159,7 +167,7 @@ size_t MapSearchNode::Hash() {
159167 return h1 ^ (h2 << 1 );
160168}
161169
162- int main (int argc, char * argv[]) {
170+ int main2 (int argc, char * argv[]) {
163171 AStarSearch<MapSearchNode> astarsearch;
164172
165173 unsigned int SearchCount = 0 ;
You can’t perform that action at this time.
0 commit comments