-
Notifications
You must be signed in to change notification settings - Fork 33
Уразаев Руслан #23
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
base: main
Are you sure you want to change the base?
Уразаев Руслан #23
Changes from 26 commits
7701de0
994853b
49a14a1
56194fb
fe91671
e190449
8f189d0
f6bbc50
e5611c6
956cb37
c7b264b
70e206c
5c49bee
71b7aea
1c9b3f8
4ce36e3
eab83c3
22bafb4
81f12bd
c0424e6
b89ef76
cb041fc
0aec85e
91f363c
9baecb4
1c50d1a
6b17498
58e4ee2
6c3b3ba
e4d78df
93e031f
f12395c
d421606
08dc6f7
5b298c0
e621748
962bd82
f5b28ff
7a1a2c7
71b6ca5
f9cf0f7
f280f35
f1f62b0
819c6fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: Testing Tasks Week 01 | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tasks: | ||
| description: 'Select tasks to test' | ||
| required: true | ||
| type: choice | ||
| default: 'all' | ||
| options: | ||
| - all | ||
| - addition | ||
| - rms | ||
| - print_bits | ||
| - check_flags | ||
| - length_lit | ||
| - quadratic | ||
| - char_changer | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install compiler and CMake | ||
| run: sudo apt install -y cmake build-essential g++-14 libgtest-dev libgmock-dev | ||
|
|
||
| - name: Configure project | ||
| run: cmake -B build | ||
|
|
||
| - name: Determine tasks to run | ||
| id: get-tasks | ||
| run: | | ||
| if [ "${{ github.event.inputs.tasks }}" = "all" ]; then | ||
| # Find all tasks | ||
| TASKS=() | ||
| for dir in 01_week/tasks/*/; do | ||
| task=$(basename "$dir") | ||
| TASKS+=("$task") | ||
| done | ||
| echo "tasks=${TASKS[*]}" >> $GITHUB_OUTPUT | ||
| else | ||
| # Используем указанную задачу | ||
| echo "tasks=${{ github.event.inputs.tasks }}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Build and run tests for selected tasks | ||
| run: | | ||
|
|
||
| IFS=' ' read -ra tasks <<< "${{ steps.get-tasks.outputs.tasks }}" | ||
|
|
||
| declare -i passed_count=0 | ||
| declare -i failed_count=0 | ||
| declare -i task_count=0 | ||
|
|
||
| echo "=== Starting tests for selected tasks ===" | ||
|
|
||
| for task in "${tasks[@]}"; do | ||
| task_count+=1 | ||
| echo "=== Processing $task ===" | ||
|
|
||
| if cmake --build build --target test_$task; then | ||
| echo "✅ test_$task built successfully" | ||
|
|
||
| if ./build/tasks/test_$task; then | ||
| echo "✅ test_$task PASSED" | ||
| passed_count+=1 | ||
| else | ||
| echo "❌ test_$task FAILED" | ||
| failed_count+=1 | ||
| fi | ||
| else | ||
| echo "❌ test_$task build FAILED" | ||
| failed_count+=1 | ||
| fi | ||
| done | ||
|
|
||
| echo "=== Test Results Summary ===" | ||
| echo "Total tasks in list: ${#tasks[@]}" | ||
| echo "Processed: $task_count" | ||
| echo "✅ Passed: $passed_count" | ||
| echo "❌ Failed: $failed_count" | ||
|
|
||
| if [ $failed_count -gt 0 ]; then | ||
| echo "❌ Some tasks failed!" | ||
| exit 1 | ||
| elif [ $task_count -eq 0 ]; then | ||
| echo "No tasks were processed (no changes)" | ||
| exit 0 | ||
| else | ||
| echo "✅ All processed tasks passed!" | ||
| exit 0 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| name: Testing Tasks Week 02 | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tasks: | ||
| description: 'Select tasks to test' | ||
| required: true | ||
| type: choice | ||
| default: 'all' | ||
| options: | ||
| - all | ||
| - swap_ptr | ||
| - func_array | ||
| - longest | ||
| - last_of_us | ||
| - little_big | ||
| - pretty_array | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install compiler and CMake | ||
| run: sudo apt install -y cmake build-essential g++-14 libgtest-dev libgmock-dev | ||
|
|
||
| - name: Configure project | ||
| run: cmake -B build | ||
|
|
||
| - name: Determine tasks to run | ||
| id: get-tasks | ||
| run: | | ||
| if [ "${{ github.event.inputs.tasks }}" = "all" ]; then | ||
| # Find all tasks | ||
| TASKS=() | ||
| for dir in 02_week/tasks/*/; do | ||
| task=$(basename "$dir") | ||
| TASKS+=("$task") | ||
| done | ||
| echo "tasks=${TASKS[*]}" >> $GITHUB_OUTPUT | ||
| else | ||
| # Используем указанную задачу | ||
| echo "tasks=${{ github.event.inputs.tasks }}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Build and run tests for selected tasks | ||
| run: | | ||
|
|
||
| IFS=' ' read -ra tasks <<< "${{ steps.get-tasks.outputs.tasks }}" | ||
|
|
||
| declare -i passed_count=0 | ||
| declare -i failed_count=0 | ||
| declare -i task_count=0 | ||
|
|
||
| echo "=== Starting tests for selected tasks ===" | ||
|
|
||
| for task in "${tasks[@]}"; do | ||
| task_count+=1 | ||
| echo "=== Processing $task ===" | ||
|
|
||
| if cmake --build build --target test_$task; then | ||
| echo "✅ test_$task built successfully" | ||
|
|
||
| if ./build/tasks/test_$task; then | ||
| echo "✅ test_$task PASSED" | ||
| passed_count+=1 | ||
| else | ||
| echo "❌ test_$task FAILED" | ||
| failed_count+=1 | ||
| fi | ||
| else | ||
| echo "❌ test_$task build FAILED" | ||
| failed_count+=1 | ||
| fi | ||
| done | ||
|
|
||
| echo "=== Test Results Summary ===" | ||
| echo "Total tasks in list: ${#tasks[@]}" | ||
| echo "Processed: $task_count" | ||
| echo "✅ Passed: $passed_count" | ||
| echo "❌ Failed: $failed_count" | ||
|
|
||
| if [ $failed_count -gt 0 ]; then | ||
| echo "❌ Some tasks failed!" | ||
| exit 1 | ||
| elif [ $task_count -eq 0 ]; then | ||
| echo "No tasks were processed (no changes)" | ||
| exit 0 | ||
| else | ||
| echo "✅ All processed tasks passed!" | ||
| exit 0 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: Testing Tasks Week 03 | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tasks: | ||
| description: 'Select tasks to test' | ||
| required: true | ||
| type: choice | ||
| default: 'all' | ||
| options: | ||
| - all | ||
| - data_stats | ||
| - unique | ||
| - range | ||
| - minmax | ||
| - find_all | ||
| - os_overload | ||
| - easy_compare | ||
| - filter | ||
| - enum_operators | ||
|
|
||
| schedule: | ||
| - cron: '59 20 18 12 *' # UTC: 20:59 = 23:59 MSK 18 December | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install compiler and CMake | ||
| run: sudo apt install -y cmake build-essential g++-14 libgtest-dev libgmock-dev | ||
|
|
||
| - name: Configure project | ||
| run: cmake -B build | ||
|
|
||
| - name: Determine tasks to run | ||
| id: get-tasks | ||
| run: | | ||
| if [ "${{ github.event.inputs.tasks }}" = "all" ]; then | ||
| # Find all tasks | ||
| TASKS=() | ||
| for dir in 03_week/tasks/*/; do | ||
| task=$(basename "$dir") | ||
| TASKS+=("$task") | ||
| done | ||
| echo "tasks=${TASKS[*]}" >> $GITHUB_OUTPUT | ||
| else | ||
| # Используем указанную задачу | ||
| echo "tasks=${{ github.event.inputs.tasks }}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Build and run tests for selected tasks | ||
| run: | | ||
|
|
||
| IFS=' ' read -ra tasks <<< "${{ steps.get-tasks.outputs.tasks }}" | ||
|
|
||
| declare -i passed_count=0 | ||
| declare -i failed_count=0 | ||
| declare -i task_count=0 | ||
|
|
||
| echo "=== Starting tests for selected tasks ===" | ||
|
|
||
| for task in "${tasks[@]}"; do | ||
| task_count+=1 | ||
| echo "=== Processing $task ===" | ||
|
|
||
| if cmake --build build --target test_$task; then | ||
| echo "✅ test_$task built successfully" | ||
|
|
||
| if ./build/tasks/test_$task; then | ||
| echo "✅ test_$task PASSED" | ||
| passed_count+=1 | ||
| else | ||
| echo "❌ test_$task FAILED" | ||
| failed_count+=1 | ||
| fi | ||
| else | ||
| echo "❌ test_$task build FAILED" | ||
| failed_count+=1 | ||
| fi | ||
| done | ||
|
|
||
| echo "=== Test Results Summary ===" | ||
| echo "Total tasks in list: ${#tasks[@]}" | ||
| echo "Processed: $task_count" | ||
| echo "✅ Passed: $passed_count" | ||
| echo "❌ Failed: $failed_count" | ||
|
|
||
| if [ $failed_count -gt 0 ]; then | ||
| echo "❌ Some tasks failed!" | ||
| exit 1 | ||
| elif [ $task_count -eq 0 ]; then | ||
| echo "No tasks were processed (no changes)" | ||
| exit 0 | ||
| else | ||
| echo "✅ All processed tasks passed!" | ||
| exit 0 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,5 @@ | ||
| #include <cstdint> | ||
| #include <stdexcept> | ||
|
|
||
|
|
||
| int64_t Addition(int a, int b) { | ||
| throw std::runtime_error{"Not implemented"}; | ||
| } | ||
| return (int64_t)a + b; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,73 @@ | ||
| #include <cstddef> | ||
| #include <stdexcept> | ||
|
|
||
| #include <cctype> | ||
| #include <string> | ||
| #include <cstring> | ||
|
|
||
| size_t CharChanger(char array[], size_t size, char delimiter = ' ') { | ||
| throw std::runtime_error{"Not implemented"}; | ||
| } | ||
| char prev_ch = array[0]; | ||
| int count_repeat = 1; | ||
|
|
||
| std::string tmp; | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. зачем все эти пустые строки? |
||
| tmp.reserve(size); | ||
|
|
||
| for (size_t i = 1; i < size - 1; ++i) { | ||
| if (array[i] == prev_ch) { | ||
| if (array[i] != ' ') { | ||
| ++count_repeat; | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это достаточно короткая ветвь, поэтому добавить строку присвоения из конца и continue, неудобно листать большой блок кода ниже |
||
| } | ||
| else { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. и else убрать поскольку он станет лишним и уйдет уровень вложенности |
||
| if (std::isdigit(prev_ch)) { | ||
| tmp += '*'; | ||
| } | ||
| else if (std::isalpha(prev_ch)) { | ||
| tmp += std::toupper(prev_ch); | ||
| } | ||
| else if (prev_ch == ' ') { | ||
| tmp += delimiter; | ||
| } | ||
| else { | ||
| tmp += '_'; | ||
| } | ||
|
|
||
| if ((count_repeat > 1) && (prev_ch != ' ')) { | ||
| if (count_repeat < 10) { | ||
| tmp += std::to_string(count_repeat); | ||
| } | ||
| else { | ||
| tmp += '0'; | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. вмесир 6 строк - одна с тернарным оператором |
||
| count_repeat = 1; | ||
| } | ||
| } | ||
|
|
||
| prev_ch = array[i]; | ||
| } | ||
|
|
||
| if (std::isdigit(prev_ch)) { | ||
| tmp += '*'; | ||
| } | ||
| else if (std::isalpha(prev_ch)) { | ||
| tmp += std::toupper(prev_ch); | ||
| } | ||
| else if (prev_ch == ' ') { | ||
| tmp += delimiter; | ||
| } | ||
| else { | ||
| tmp += '_'; | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. как будто полное дублирование |
||
|
|
||
| if ((count_repeat > 1) && (prev_ch != ' ')) { | ||
| if (count_repeat < 10) { | ||
| tmp += std::to_string(count_repeat); | ||
| } | ||
| else { | ||
| tmp += '0'; | ||
| } | ||
| } | ||
|
|
||
| std::strcpy(array, tmp.c_str()); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. неэффективное решение, поддерживать полную копию, можно было реализовать с измененние по месту |
||
| return std::strlen(array); | ||
| } | ||
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.
c-style cast не уместен, static_cast