-
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
Merged
feat: 移除和模板无关的代码 #43
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
30317eb
fix: 纠正README.md中的链接
Certseeds 004aaa1
feat: 现在catch2由本地tar.gz确认版本
Certseeds 4cbd6dd
feat: 移除 basic 目录
Certseeds 2ddce6f
feat: 移除大部分用例, 提高编译速度
Certseeds 8f383f4
build: 修改release分支发布模式
Certseeds 7a651f7
feat: lab_00 使用新风格
Certseeds 6e473ad
fix: 修复测试路径问题
Certseeds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| cmake_minimum_required(VERSION 3.16.6) | ||
| set(YEAR 2021) | ||
| set(SEMESTER FALL) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 11) | ||
| project(CS203_DSAA_${YEAR}_${SEMESTER} LANGUAGES CXX) | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
|
|
||
| enable_testing() | ||
| file(GLOB USER_LIBS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lab_*) # regex to find libs, more flexibility | ||
| foreach (elementName IN LISTS USER_LIBS_PATH) | ||
| add_subdirectory(${elementName}) | ||
| endforeach () | ||
| unset(USER_LIBS_PATH) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| cmake_minimum_required(VERSION 3.16.6) | ||
| set(PROBLEM_ORDER A) | ||
| project(${PROJECT_NAME}_${PROBLEM_ORDER}) | ||
|
|
||
| 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) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
| // SPDX-FileCopyrightText: 2020-2025 nanoseeds | ||
| #ifdef ALGORITHM_TEST_MACRO | ||
|
|
||
| #include <catch_main.hpp> | ||
| #include <tuple> | ||
| #include <vector> | ||
| #include <cstdint> | ||
| #include <iostream> | ||
|
|
||
| #include "main.cpp" | ||
|
|
||
| std::string getFilePath() noexcept { return "./../../../../2021F/lab_02/lab_02_A/resource/"; } | ||
|
|
||
| const std::string CS203_redirect::file_paths = getFilePath(); | ||
|
|
||
| namespace lab_02_A { | ||
| using std::tie; | ||
| using std::cin; | ||
| using std::cout; | ||
| using std::tuple; | ||
| using std::vector; | ||
|
|
||
| TEST_CASE("test case with sequence", "[test 02 A]") { | ||
| CS203_sequence sequence{1, 1, 0}; // // 基础设定,[1,1] | ||
| sequence.set_postfix_of_datain("data.in"); // 输入数据后缀,默认为 data.in | ||
| sequence.set_postfix_of_dataout("data.out"); // except输出数据后缀,默认为 data.out | ||
| sequence.set_postfix_of_testout("test.out"); // 测试输出数据后缀,默认为 test.out | ||
| const auto files_name = sequence.get_files(true); | ||
| // 获取一个std::tuple<string,string,string> , | ||
| // 其中每个tuple内为 `输入数据`,`except输出数据`,`测试输出数据`名. | ||
| for (const auto &file_name: files_name) { | ||
| string datain, dataout, testout; // 声明 | ||
| tie(datain, dataout, testout) = file_name; // 解包 | ||
| { | ||
| const CS203_redirect cr{datain, testout}; // 重定向输入,输出 | ||
| main(); | ||
| // 用括号括住是为了让CS203_redirect在这里被析构,停止重定向 | ||
| } | ||
| CHECK(compareFiles(testout, dataout)); | ||
| } | ||
| } | ||
| } | ||
| #endif //ALGORITHM_TEST_MACRO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| cmake_minimum_required(VERSION 3.16.6) | ||
| set(PROBLEM_ORDER B) | ||
| project(${PROJECT_NAME}_${PROBLEM_ORDER}) | ||
|
|
||
| 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) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
| // SPDX-FileCopyrightText: 2020-2025 nanoseeds | ||
| #ifdef ALGORITHM_TEST_MACRO | ||
|
|
||
| #include <catch_main.hpp> | ||
| #include <tuple> | ||
| #include <vector> | ||
| #include <cstdint> | ||
| #include <iostream> | ||
|
|
||
| #include "main.cpp" | ||
|
|
||
| std::string getFilePath() noexcept { return "./../../../../2021F/lab_02/lab_02_B/resource/"; } | ||
|
|
||
| const std::string CS203_redirect::file_paths = getFilePath(); | ||
|
|
||
| namespace lab_02_B { | ||
|
|
||
| using std::tie; | ||
| using std::cin; | ||
| using std::cout; | ||
| using std::tuple; | ||
| using std::vector; | ||
|
|
||
| TEST_CASE("test case with sequence", "[test 02 B]") { | ||
| CS203_sequence sequence{1, 3, 0}; // // 基础设定,[1,1] | ||
| sequence.set_postfix_of_datain("data.in"); // 输入数据后缀,默认为 data.in | ||
| sequence.set_postfix_of_dataout("data.out"); // except输出数据后缀,默认为 data.out | ||
| sequence.set_postfix_of_testout("test.out"); // 测试输出数据后缀,默认为 test.out | ||
| const auto files_name = sequence.get_files(true); | ||
| // 获取一个std::tuple<string,string,string> , | ||
| // 其中每个tuple内为 `输入数据`,`except输出数据`,`测试输出数据`名. | ||
| for (const auto &file_name: files_name) { | ||
| string datain, dataout, testout; // 声明 | ||
| tie(datain, dataout, testout) = file_name; // 解包 | ||
| { | ||
| const CS203_redirect cr{datain, testout}; // 重定向输入,输出 | ||
| main(); | ||
| // 用括号括住是为了让CS203_redirect在这里被析构,停止重定向 | ||
| } | ||
| CHECK(compareFiles(testout, dataout)); | ||
| } | ||
| } | ||
| } | ||
| #endif //ALGORITHM_TEST_MACRO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| cmake_minimum_required(VERSION 3.16.6) | ||
| set(PROBLEM_ORDER C) | ||
| project(${PROJECT_NAME}_${PROBLEM_ORDER}) | ||
|
|
||
| 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) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
| // SPDX-FileCopyrightText: 2020-2025 nanoseeds | ||
| #ifdef ALGORITHM_TEST_MACRO | ||
|
|
||
| #include <catch_main.hpp> | ||
| #include <tuple> | ||
| #include <vector> | ||
| #include <cstdint> | ||
| #include <iostream> | ||
| #include "main.cpp" | ||
|
|
||
| std::string getFilePath() noexcept { return "./../../../../2021F/lab_02/lab_02_C/resource/"; } | ||
|
|
||
| const std::string CS203_redirect::file_paths = getFilePath(); | ||
|
|
||
| namespace lab_02_C { | ||
|
|
||
| using std::tie; | ||
| using std::cin; | ||
| using std::cout; | ||
| using std::tuple; | ||
| using std::vector | ||
| ; | ||
| // 用wolframalpha 计算的 xe^(x/20)= b | ||
| TEST_CASE("test case 1", "[test 02 C]") { | ||
| const Catch::Approx target = Catch::Approx(0.9534862518).epsilon(0.01); | ||
| CHECK(cal_detail(1) == target); | ||
| const Catch::Approx target2 = Catch::Approx( | ||
| 257.40091767269424137944971165126822636856843117329338741172807922).epsilon(0.01); | ||
| CHECK(cal_detail(std::pow(10, 8)) == target2); | ||
| } | ||
| // 因为[.],所以下面这个被隐藏了,确保需要重定向输入输出时,请删除`[.]` | ||
| // 此处因为输出为 "一个范围",不适合进行直接比对输出 | ||
| TEST_CASE("test case with sequence", "[test 02 C][.]") { | ||
| CS203_sequence sequence{1, 0, 0}; // // 基础设定,[1,1] | ||
| sequence.set_postfix_of_datain("data.in"); // 输入数据后缀,默认为 data.in | ||
| sequence.set_postfix_of_dataout("data.out"); // except输出数据后缀,默认为 data.out | ||
| sequence.set_postfix_of_testout("test.out"); // 测试输出数据后缀,默认为 test.out | ||
| const auto files_name = sequence.get_files(true); | ||
| // 获取一个std::tuple<string,string,string> , | ||
| // 其中每个tuple内为 `输入数据`,`except输出数据`,`测试输出数据`名. | ||
| for (const auto &file_name: files_name) { | ||
| string datain, dataout, testout; // 声明 | ||
| tie(datain, dataout, testout) = file_name; // 解包 | ||
| { | ||
| const CS203_redirect cr{datain, testout}; // 重定向输入,输出 | ||
| main(); | ||
| // 用括号括住是为了让CS203_redirect在这里被析构,停止重定向 | ||
| } | ||
| CHECK(compareFiles(testout, dataout)); | ||
| } | ||
| } | ||
| } | ||
| #endif //ALGORITHM_TEST_MACRO | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.