Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 4 additions & 16 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ jobs:
gcc --version
g++ --version

- name: prepare libopencv
- name: prepare deps
run: |
sudo apt-get update && sudo apt-get install libopencv-dev
bash ./third_party/install.sh

- name: Use cmake
run: cmake --version
Expand All @@ -65,20 +65,8 @@ jobs:
working-directory: ./CMAKE_DEBUG_PATH/lab_00
run: cmake --build . --config DEBUG --parallel

- name: cmake compile algorithm/2021F
working-directory: ./CMAKE_DEBUG_PATH/algorithm/2021F
run: cmake --build . --config DEBUG --parallel

- name: cmake compile algorithm/matrix
working-directory: ./CMAKE_DEBUG_PATH/algorithm/matrix
run: cmake --build . --config DEBUG --parallel

- name: cmake compile algorithm
working-directory: ./CMAKE_DEBUG_PATH/algorithm/
run: cmake --build .

- name: cmake compile basic
working-directory: ./CMAKE_DEBUG_PATH/basic
- name: cmake compile 2021F
working-directory: ./CMAKE_DEBUG_PATH/2021F
run: cmake --build . --config DEBUG --parallel

- name: cmake compile
Expand Down
51 changes: 16 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
gcc --version
g++ --version

- name: prepare libopencv ccache
- name: prepare deps
run: |
sudo apt-get install libopencv-dev ccache
bash ./third_party/install.sh

- name: Use cmake
run: cmake --version
Expand All @@ -51,20 +51,8 @@ jobs:
working-directory: ./CMAKE_DEBUG_PATH/lab_00
run: cmake --build . --config DEBUG --parallel

- name: cmake compile algorithm/2021F
working-directory: ./CMAKE_DEBUG_PATH/algorithm/2021F
run: cmake --build . --config DEBUG --parallel

- name: cmake compile algorithm/matrix
working-directory: ./CMAKE_DEBUG_PATH/algorithm/matrix
run: cmake --build . --config DEBUG --parallel

- name: cmake compile algorithm
working-directory: ./CMAKE_DEBUG_PATH/algorithm/
run: cmake --build .

- name: cmake compile basic
working-directory: ./CMAKE_DEBUG_PATH/basic
- name: cmake compile 2021F
working-directory: ./CMAKE_DEBUG_PATH/2021F
run: cmake --build . --config DEBUG --parallel

- name: cmake compile
Expand Down Expand Up @@ -106,17 +94,14 @@ jobs:
SOURCE_BRANCH: ${{ steps.branch_name.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}

- name: prepare libopencv
run: |
sudo apt-get update && sudo apt-get install libopencv-dev
# ensure the path and files of project
- name: ensure the path and files of project
run: sudo apt-get install tree; tree; mkdir -p ./cmake_build_release

- name: cmake install dependencies
- name: prepare deps
run: |
cmake -S . -B ./cmake_build_release -DCMAKE_BUILD_TYPE=Debug
rm -rf ./cmake_build_release
bash ./third_party/install.sh
bash ./third_party/rename.sh

- name: move cmake-fetchcontent to folder
working-directory: ./third_party
Expand Down Expand Up @@ -171,30 +156,26 @@ jobs:
env:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}

- name: git operations
run: |
git config --global user.name 'Certseeds'
git config --global user.email '51754303+Certseeds@users.noreply.github.com'
git checkout -b release
mkdir cmake_build_release

- name: prepare libopencv
- name: prepare deps
run: |
sudo apt-get update && sudo apt-get install libopencv-dev
bash ./third_party/install.sh
bash ./third_party/rename.sh

- name: cmake install dependencies
- name: git operations
run: |
cmake -S . -B ./cmake_build_release -DCMAKE_BUILD_TYPE=Debug
rm -rf ./cmake_build_release
git config --global user.name 'Certseeds'
git config --global user.email '51754303+Certseeds@users.noreply.github.com'
git checkout --orphan release

- name: move cmake-fetchcontent to folder
working-directory: ./third_party
run: |
echo '**/.github/*' > ./.gitignore
rm ./CMakeLists.txt
mv ./CMakeLists.release.txt ./CMakeLists.txt
git add .
git commit -am "dependencies: add dependencies to release branch"
git add -A
git commit -am "init: with deps"

- name: run script
working-directory: ./script
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/rust_build.yml

This file was deleted.

14 changes: 14 additions & 0 deletions 2021F/CMakeLists.txt
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.
16 changes: 16 additions & 0 deletions 2021F/lab_02/lab_02_A/CMakeLists.txt
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)
44 changes: 44 additions & 0 deletions 2021F/lab_02/lab_02_A/test.cpp
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
16 changes: 16 additions & 0 deletions 2021F/lab_02/lab_02_B/CMakeLists.txt
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)
45 changes: 45 additions & 0 deletions 2021F/lab_02/lab_02_B/test.cpp
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
16 changes: 16 additions & 0 deletions 2021F/lab_02/lab_02_C/CMakeLists.txt
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)
54 changes: 54 additions & 0 deletions 2021F/lab_02/lab_02_C/test.cpp
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
Comment on lines +22 to +24
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.
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
Loading