Skip to content

Commit 3a4fde7

Browse files
konardclaude
andcommitted
Create C++ structure with Platform.Bot.Tests.cpp instead of AllTests.cpp
- Added CMakeLists.txt with correct ${PROJECT_NAME}.Tests.cpp reference - Created Platform.Bot.Tests/Platform.Bot.Tests.cpp following linksplatform naming convention - Follows issue #140 requirement to use PROJECT_NAME pattern instead of AllTests.cpp 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 5a2789f commit 3a4fde7

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

cpp/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
3+
set(LINKS_PLATFORM_TESTS OFF CACHE BOOL "Whether to compile tests")
4+
set(LINKS_PLATFORM_EXTRA_FLAGS "" CACHE STRING "Extra compiler flags")
5+
6+
set(CONAN_DISABLE_CHECK_COMPILER TRUE)
7+
set(LINKS_PLATFORM_TESTS TRUE)
8+
9+
project(Platform.Bot CXX)
10+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
11+
12+
find_package(GTest)
13+
14+
add_library(${PROJECT_NAME}.Library INTERFACE)
15+
target_include_directories(${PROJECT_NAME}.Library INTERFACE ${PROJECT_NAME})
16+
17+
target_compile_options(${PROJECT_NAME}.Library INTERFACE ${LINKS_PLATFORM_EXTRA_FLAGS})
18+
19+
if(${LINKS_PLATFORM_TESTS})
20+
add_executable(${PROJECT_NAME}.Tests ${PROJECT_NAME}.Tests/${PROJECT_NAME}.Tests.cpp)
21+
set_target_properties(${PROJECT_NAME}.Tests PROPERTIES CXX_STANDARD 20)
22+
target_link_libraries(${PROJECT_NAME}.Tests PRIVATE GTest::gtest)
23+
target_link_libraries(${PROJECT_NAME}.Tests PRIVATE GTest::gtest_main)
24+
target_link_libraries(${PROJECT_NAME}.Tests PRIVATE ${PROJECT_NAME}.Library)
25+
endif()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <gtest/gtest.h>
2+
3+
namespace Platform::Bot::Tests
4+
{
5+
TEST(BotTests, BasicTest)
6+
{
7+
EXPECT_TRUE(true);
8+
}
9+
}
10+
11+
int main(int argc, char **argv)
12+
{
13+
::testing::InitGoogleTest(&argc, argv);
14+
return RUN_ALL_TESTS();
15+
}

0 commit comments

Comments
 (0)