diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ae86e99..6f920eda 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: working-directory: ./../ run: | echo $(pwd) - zip -r script_no_need.zip ./CS203_DSAA_template -x "./.git/*" + zip -r script_no_need.zip ./CS203_DSAA_template -x "*/.git/*" echo $(pwd) - name: Create Release @@ -55,8 +55,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: 0.0.6.2 - release_name: 0.0.6.2 + tag_name: 0.0.6.3 + release_name: 0.0.6.3 draft: false prerelease: false diff --git a/script/cpp_template.txt b/script/cpp_template.txt index 60e7793e..f6c978bf 100644 --- a/script/cpp_template.txt +++ b/script/cpp_template.txt @@ -1,36 +1,3 @@ -/** - * @Github: https://github.com/{0}/CS203_DSAA_template - * @Organization: SUSTech - * @Author: {1} - * @Date: {2} - * @LastEditors: {1} - * @LICENSE: MIT - */ -/* -MIT License - -CS203_DSAA_template - -Copyright (C) {3} {1} - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ #include #include #include diff --git a/script/cpp_test_template.txt b/script/cpp_test_template.txt index e7ce1f04..4e251d98 100644 --- a/script/cpp_test_template.txt +++ b/script/cpp_test_template.txt @@ -1,36 +1,3 @@ -/** - * @Github: https://github.com/{0}/CS203_DSAA_template - * @Organization: SUSTech - * @Author: {1} - * @Date: {2} - * @LastEditors: {1} - * @LICENSE: MIT - */ -/* -MIT License - -CS203_DSAA_template - -Copyright (C) {3} {1} - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ #ifndef CS203_DSAA_TEST_MACRO #define CS203_DSAA_TEST_MACRO @@ -38,7 +5,7 @@ SOFTWARE. #include #include #include "catch_main.hpp" -#include "lab_{4}_{5}.cpp" +#include "lab_{0}_{1}.cpp" using std::tie; using std::cin; @@ -49,9 +16,9 @@ using std::vector; using Catch::Matchers::Equals; using Catch::Matchers::UnorderedEquals; using Catch::Matchers::Contains; -const string test_file_path = "./../test/lab_{4}/lab_{4}_{5}_data/"; +const string test_file_path = "./../test/lab_{0}/lab_{0}_{1}_data/"; -TEST_CASE("test case 1", "[test {4} {5}]") {{ +TEST_CASE("test case 1", "[test {0} {1}]") {{ auto output = cal(std::make_tuple(114, 514)); CHECK(output == 628); CHECK(1 + 2 == 3); diff --git a/script/file_header.txt b/script/file_header.txt new file mode 100644 index 00000000..3202c6ee --- /dev/null +++ b/script/file_header.txt @@ -0,0 +1,33 @@ +/** + * @Github: https://github.com/{0}/CS203_DSAA_template + * @Organization: SUSTech + * @Author: {1} + * @Date: {2} + * @LastEditors: {1} + * @LICENSE: MIT + */ +/* +MIT License + +CS203_DSAA_template + +Copyright (C) {3} {1} + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ diff --git a/script/file_template.py b/script/file_template.py index 9c536ef1..ba7f7e56 100644 --- a/script/file_template.py +++ b/script/file_template.py @@ -41,6 +41,7 @@ main_code_template: str test_code_template: str +file_header_template: str GITHUB_USER: str = "YOUR_GITHUB_NAME" # example: Certseeds USER: str = "YOUR_USER_NAME" # example: nanoseeds year: str = time.strftime("%Y", time.localtime()) @@ -58,10 +59,12 @@ def read_file(file_name: str) -> str: def fill_file(lab_number: str, problem_order: str) -> None: with open(source_path.format(lab_number, lab_number, problem_order), mode='a+', encoding="UTF-8") as file: - file.write(main_code_template.format(GITHUB_USER, USER, create_time, year)) - print("main finish\n") + file.write(file_header_template.format(GITHUB_USER, USER, create_time, year)) + file.write(main_code_template) + print("main finish") with open(test_path.format(lab_number, lab_number, problem_order), mode='a+', encoding="UTF-8") as file: - file.write(test_code_template.format(GITHUB_USER, USER, create_time, year, lab_number, problem_order)) + file.write(file_header_template.format(GITHUB_USER, USER, create_time, year)) + file.write(test_code_template.format(lab_number, problem_order)) print('test finish') @@ -74,8 +77,9 @@ def try_mkdir(lab_number: str) -> None: # range in [begin,end) if __name__ == '__main__': - main_code_template: str = read_file("cpp_template.txt") - test_code_template: str = read_file("cpp_test_template.txt") + file_header_template = read_file("file_header.txt") + main_code_template = read_file("cpp_template.txt") + test_code_template = read_file("cpp_test_template.txt") labs: List[str] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15'] problem_order: List[chr] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']