Skip to content

Conversation

@Certseeds
Copy link
Owner

Type of change

This commit Works for

  • The template itself

PS:这个是单选

What kind of this pr?

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • This can pass test in my platform
  • This can pass test in GitHub Actions

PS: please ensure both of them are ok

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

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>
@Certseeds Certseeds self-assigned this Oct 18, 2025
Copilot AI review requested due to automatic review settings October 18, 2025 11:16
@Certseeds Certseeds added the enhancement New feature or request label Oct 18, 2025
@Certseeds Certseeds merged commit 22b220b into master Oct 18, 2025
4 checks passed
Copy link

Copilot AI left a 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.

Comment on lines +5 to +16
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)
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +16
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)
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +16
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)
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +24
using std::vector
;
// 用wolframalpha 计算的 xe^(x/20)= b
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
using std::vector
;
// 用wolframalpha 计算的 xe^(x/20)= b
using std::vector;
// 用wolframalpha 计算的 xe^(x/20)= b

Copilot uses AI. Check for mistakes.

#include "main.cpp"

std::string getFilePath() noexcept { return "./../../../../2021F/lab_04/lab_04_A/resource/"; }
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
std::string getFilePath() noexcept { return "./../../../../2021F/lab_04/lab_04_A/resource/"; }
std::string getFilePath() noexcept { return "./../../../../2021F/lab_04/lab_04_2A/resource/"; }

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants