Skip to content

Commit

Permalink
publish version 0.0.7
Browse files Browse the repository at this point in the history
publish version 0.0.7
  • Loading branch information
Certseeds authored Aug 5, 2020
2 parents ef62ece + bb9737f commit 4c96422
Show file tree
Hide file tree
Showing 31 changed files with 996 additions and 208 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# @Github: https://github.com/Certseeds/CS203_DSAA_template
# @Organization: SUSTech
# @Author: nanoseeds
# @Date: 2020-07-26 16:36:10
# @LastEditors: nanoseeds
#@LastEditTime: 2020-07-26 16:43:03
# This is a basic workflow to help you get started with Actions

name: test for pull_request

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
branches: [ master ]
push:
branches: [ dev ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: test for pull_request
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v2

# ensure the path and files of project
- name: ensure the path and files of project
run: sudo apt install tree; tree

- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.10.2'

- name: Use cmake
run: cmake --version

- name: prepare permission
working-directory: ./script
run: chmod 0755 ./test.sh

- name: run the test script
working-directory: ./script
run: ./test.sh

- name: tree
run: tree

# This workflow contains a single job called "build"
build:
name: test for the release script
needs: test
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v2

# ensure the path and files of project
- name: ensure the path and files of project
run: sudo apt install tree; tree

- name: run script
working-directory: ./script
run: python3 file_template.py

- name: tree the packet
run: tree

59 changes: 17 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ name: test and release
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -32,10 +30,7 @@ jobs:

# ensure the path and files of project
- name: ensure the path and files of project
run: |
echo Hello, world!
echo $(pwd)
ls -la
run: sudo apt install tree; tree

- name: Setup cmake
uses: jwlawson/[email protected]
Expand All @@ -45,31 +40,17 @@ jobs:
- name: Use cmake
run: cmake --version

- name: mkdir for build
run: mkdir ./cmake_build_path
- name: prepare permission
working-directory: ./script
run: chmod 0755 ./test.sh

- name: build the project
working-directory: ./cmake_build_path
run: |
cmake ..
make
- name: run the test script
working-directory: ./script
run: ./test.sh

- name: run the test
working-directory: ./cmake_build_path
run: ./CS203_DSAA_template_test

- name: run the algorithm_sort_test
working-directory: ./cmake_build_path/algorithm/sort
run: ./basic_algorithms_sort

- name: run the binary_search test
working-directory: ./cmake_build_path/algorithm/binary_search
run: ./basic_algorithms_binary_search
- name: tree
run: tree

- name: Run a multi-line script
run: |
echo $(pwd)
ls -la
# This workflow contains a single job called "build"
build:
name: publish release
Expand All @@ -87,30 +68,26 @@ jobs:

# ensure the path and files of project
- name: ensure the path and files of project
run: |
echo Hello, world!
echo $(pwd)
ls -la
run: sudo apt install tree; tree

- name: run script
working-directory: ./script
run: python3 file_template.py

- name: zip the packet
working-directory: ./../
run: |
echo $(pwd)
zip -r script_no_need.zip ./CS203_DSAA_template -x "*/.git/*"
echo $(pwd)
tree
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 0.0.6.4
release_name: 0.0.6.4
tag_name: 0.0.7
release_name: 0.0.7
draft: false
prerelease: false

Expand All @@ -130,8 +107,6 @@ jobs:
asset_name: script_no_need.zip
asset_content_type: application/zip

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo $(pwd)
ls -la
- name: tree
run: tree

56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# @Github: https://github.com/Certseeds/CS203_DSAA_template
# @Organization: SUSTech
# @Author: nanoseeds
# @Date: 2020-07-27 22:08:31
# @LastEditors: nanoseeds
# @LastEditTime: 2020-07-27 22:10:08

name: test for dev

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ dev ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: test dev
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout code
uses: actions/checkout@v2

# ensure the path and files of project
- name: ensure the path and files of project
run: |
sudo apt install tree
tree
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.10.2'

- name: Use cmake
run: cmake --version

- name: prepare permission
working-directory: ./script
run: chmod 0755 ./test.sh

- name: run the test script
working-directory: ./script
run: ./test.sh

- name: tree
run: tree
# This workflow contains a single job called "build"

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## @Author: nanoseeds
## @Date: 2020-07-15 23:48:29
## @LastEditors: nanoseeds
## @LastEditTime: 2020-07-27 10:19:54
## @LastEditTime: 2020-07-28 10:16:00
###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Expand Down Expand Up @@ -309,6 +309,7 @@ _deps
# CMake
cmake-build-*/
cmake_build_*/
build/
# idea
.idea/*
!.idea/codeStyles
Expand Down
1 change: 1 addition & 0 deletions .idea/fileTemplates/internal/C Header File.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/fileTemplates/internal/C Source File.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/fileTemplates/internal/C++ Class.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
},
"git.ignoreLimitWarning": true,
"shellcheck.enable": true, // 安装以后默认就是激活的
"shellcheck.executablePath": "/usr/bin/shellcheck", // 也可以是shellcheck
"shellcheck.executablePath": "/usr/local/bin/shellcheck", // 也可以是shellcheck
"shellcheck.run": "onType", // "onType"敲击键盘的时候检查,onSave是保存文件时候检查
"shellcheck.useWSL": true,
//"shellcheck.useWSL": true,
"shellcheck.enableQuickFix": true,
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}",
"todo-tree.general.tags": [
Expand Down Expand Up @@ -173,7 +173,8 @@
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"variant": "cpp"
"variant": "cpp",
"__functional_03": "cpp"
},
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
+ PS: 就像下面的修改,增加了两个Bonus_Lab,同时给每个Lab中的C拆分成了C1 && C2
``` python
labs: List[str] = ['01', '02', '03', '03Bouns', '04', '05', '06', '07','07Bouns','08', '09']
problem_order: List[chr] = ['A', 'B', 'C1', 'C2','D', 'E', 'F', 'G']
problem_order: List[str] = ['A', 'B', 'C1', 'C2','D', 'E', 'F', 'G']
```
+ 执行代码和测试:
+ 使用clion打开文件夹,配置好C++环境的基础上,会自动识别`CmakeList.txt`.产生`CS203_DSAA_template`,`CS203_DSAA_template_test`两个可以运行的可选项.
Expand Down Expand Up @@ -93,13 +93,13 @@
+ 比如[判断二分图](./source/lab_00/lab_00_C.cpp),一张图可以有几十上百个node,写在内部占用空间太大.
+ 而在这里,使用`CS203_redirect`对象,便可以省去手动输入的方式.
``` cpp
const string test_file_path = "./../test/lab_00/lab_00_C_data/";
TEST_CASE("test case 1", "[test 00 C]") {
CS203_redirect cr{test_file_path + "01.data.in", ""};
CS203_redirect cr{"01.data.in", ""};
// 重定向开始,开始run
auto result_data = isBipartite(read());
// or CS203_redirect cr{"01.data.in"};
auto output_data = isBipartite(read());
// 重定向结束
CHECK_FALSE(result_data);
CHECK_FALSE(output_data);
}
```
只需要准备好输入的数据与结果,就可以从文件中读取,执行后判断结果是否符合预期.
Expand All @@ -115,18 +115,18 @@
+ 一般来说,题目的输出不会太复杂,但是反例也不是没有.:比如专门考输出的[立体图](./source/lab_00/lab_00_D.cpp)
+ 这种情况下,使用c++的重定向输出就可以较为方便的对输入进行处理,同时保存输出方便调试.
``` cpp
const string test_file_path = "./../test/lab_00/lab_00_D_data/";
TEST_CASE("test case 2", "[test 00 C]") {
TEST_CASE("test case 2", "[test 00 D]") {
SECTION("do") {
CS203_redirect cr{test_file_path + "01.data.in", test_file_path + "01.test.out"};
cal(read());
CS203_redirect cr{"01.data.in", "01.test.out"};
auto input_data = read();
cal(input_data);
}SECTION("compare files") {
CHECK(compareFiles(test_file_path + "01.test.out", test_file_path + "01.data.out"));
CHECK(compareFiles("01.test.out", "01.data.out"));
}
}
```
这样就将标准输出重定向到了01.test.out中,并与01.data.out比对.
+ 至于比较文件之间的差异,可以使用内置的`compareFiles(const string& path1,const string& path2)`函数进行比较.
+ 至于比较文件之间的差异,可以使用内置的`compareFiles(string path1,string path2)`函数进行比较.
参考[文本比对_test_case_2](./test/lab_00/lab_00_D_test.cpp)

5. 为什么要将 `读取` `数据处理` `输出` 分开?
Expand Down
2 changes: 2 additions & 0 deletions algorithm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_subdirectory(./sort)

add_subdirectory(./binary_search)

add_subdirectory(./tree)
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ project(basic_algorithms_binary_search LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_executable(${PROJECT_NAME}
./basic.cpp
)
#./basic.cpp
./triple_search.cpp
#rotate_array.cpp
)
Loading

0 comments on commit 4c96422

Please sign in to comment.