-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 移除和模板无关的代码 #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 移除和模板无关的代码 #43
Conversation
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes template-unrelated code by adding CMake build files and test infrastructure for 2021F lab exercises. The changes establish a standardized build system across multiple lab problems with consistent C++ standard configurations and test frameworks.
- Adds CMakeLists.txt files for all lab exercises from lab_02 to lab_06
- Implements uniform test.cpp files with Catch2-based test framework integration
- Updates GitHub Actions workflows to focus on the consolidated 2021F structure
Reviewed Changes
Copilot reviewed 73 out of 2117 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| 2021F/CMakeLists.txt | Root CMake configuration for the 2021F lab exercises |
| Multiple lab CMakeLists.txt files | Individual CMake configurations for each lab problem |
| Multiple lab test.cpp files | Standardized test infrastructure using Catch2 framework |
| .github/workflows/*.yml | Updated CI/CD workflows to build the new 2021F structure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| set(CMAKE_CXX_STANDARD 11) | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
|
|
||
| enable_testing() | ||
| add_executable(${PROJECT_NAME} main.cpp) | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| add_executable(${PROJECT_NAME}_test test.cpp) | ||
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | ||
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | ||
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | ||
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | ||
| set(CMAKE_CXX_STANDARD 11) |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CMAKE_CXX_STANDARD is set multiple times with conflicting values (11 and 17). This creates ambiguity about which standard should be used and may cause unexpected behavior. Consider using a consistent C++ standard throughout the file or document why different standards are needed for different targets.
| set(CMAKE_CXX_STANDARD 11) | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
| enable_testing() | |
| add_executable(${PROJECT_NAME} main.cpp) | |
| set(CMAKE_CXX_STANDARD 17) | |
| add_executable(${PROJECT_NAME}_test test.cpp) | |
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | |
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | |
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | |
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | |
| set(CMAKE_CXX_STANDARD 11) | |
| # set(CMAKE_CXX_STANDARD 11) -- removed, set per target below | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
| enable_testing() | |
| add_executable(${PROJECT_NAME} main.cpp) | |
| set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) | |
| add_executable(${PROJECT_NAME}_test test.cpp) | |
| set_target_properties(${PROJECT_NAME}_test PROPERTIES CXX_STANDARD 17) | |
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | |
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | |
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | |
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | |
| # set(CMAKE_CXX_STANDARD 11) -- removed, set per target above |
| set(CMAKE_CXX_STANDARD 11) | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
|
|
||
| enable_testing() | ||
| add_executable(${PROJECT_NAME} main.cpp) | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| add_executable(${PROJECT_NAME}_test test.cpp) | ||
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | ||
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | ||
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | ||
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | ||
| set(CMAKE_CXX_STANDARD 11) |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CMAKE_CXX_STANDARD is set multiple times with conflicting values (11 and 17). This creates ambiguity about which standard should be used and may cause unexpected behavior. Consider using a consistent C++ standard throughout the file or document why different standards are needed for different targets.
| set(CMAKE_CXX_STANDARD 11) | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
| enable_testing() | |
| add_executable(${PROJECT_NAME} main.cpp) | |
| set(CMAKE_CXX_STANDARD 17) | |
| add_executable(${PROJECT_NAME}_test test.cpp) | |
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | |
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | |
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | |
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | |
| set(CMAKE_CXX_STANDARD 11) | |
| set(CMAKE_CXX_STANDARD 17) | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | |
| enable_testing() | |
| add_executable(${PROJECT_NAME} main.cpp) | |
| add_executable(${PROJECT_NAME}_test test.cpp) | |
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | |
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | |
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | |
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) |
| set(CMAKE_CXX_STANDARD 17) | ||
| add_executable(${PROJECT_NAME}_test test.cpp) | ||
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | ||
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | ||
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | ||
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | ||
| set(CMAKE_CXX_STANDARD 11) |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CMAKE_CXX_STANDARD is set multiple times with conflicting values (11 and 17). This creates ambiguity about which standard should be used and may cause unexpected behavior. Consider using a consistent C++ standard throughout the file or document why different standards are needed for different targets.
| set(CMAKE_CXX_STANDARD 17) | |
| add_executable(${PROJECT_NAME}_test test.cpp) | |
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | |
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | |
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | |
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) | |
| set(CMAKE_CXX_STANDARD 11) | |
| # Set C++ standard for test target explicitly | |
| add_executable(${PROJECT_NAME}_test test.cpp) | |
| set_target_properties(${PROJECT_NAME}_test PROPERTIES CXX_STANDARD 17) | |
| target_compile_definitions(${PROJECT_NAME}_test PRIVATE ALGORITHM_TEST_MACRO) | |
| target_link_libraries(${PROJECT_NAME}_test PRIVATE algorithm_template_INCLUDE) | |
| MESSAGE(STATUS "${PROJECT_NAME}_${elementName} from ${CMAKE_CURRENT_SOURCE_DIR}/test.cpp") | |
| add_test(${PROJECT_NAME}_CTEST ${PROJECT_NAME}_test) |
| using std::vector | ||
| ; | ||
| // 用wolframalpha 计算的 xe^(x/20)= b |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semicolon should be on the same line as the using declaration. The current formatting creates unnecessary line breaks and deviates from standard C++ formatting practices.
| using std::vector | |
| ; | |
| // 用wolframalpha 计算的 xe^(x/20)= b | |
| using std::vector; | |
| // 用wolframalpha 计算的 xe^(x/20)= b |
|
|
||
| #include "main.cpp" | ||
|
|
||
| std::string getFilePath() noexcept { return "./../../../../2021F/lab_04/lab_04_A/resource/"; } |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file path points to 'lab_04_A/resource/' but this is in the 'lab_04_2A' directory. The path should likely be './../../../../2021F/lab_04/lab_04_2A/resource/' to match the current directory structure.
| std::string getFilePath() noexcept { return "./../../../../2021F/lab_04/lab_04_A/resource/"; } | |
| std::string getFilePath() noexcept { return "./../../../../2021F/lab_04/lab_04_2A/resource/"; } |
Type of change
This commit Works for
PS:这个是单选
What kind of this pr?
How Has This Been Tested?
PS: please ensure both of them are ok
Checklist