Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

[task_02] Labwork2#362

Open
PTUshnik wants to merge 6 commits into
brstu:mainfrom
PTUshnik:Laba2
Open

[task_02] Labwork2#362
PTUshnik wants to merge 6 commits into
brstu:mainfrom
PTUshnik:Laba2

Conversation

@PTUshnik
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings December 21, 2025 14:31
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 21, 2025

📌 Duplicate code detection tool report

The tool analyzed your source code and found the following degree of similarity between the files:

trunk/ii002713/task_03/doc/html/index.md

📄 trunk/ii002713/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02810/task_03/doc/pages/index.md 92.75
trunk/ii02801/task_03/api.md 92.33
trunk/ii002826/task_03/doc/html/index.md 92.26
trunk/ii002717/task_01/src/main.cpp

📄 trunk/ii002717/task_01/src/main.cpp

File Similarity (%)
trunk/ii02717/task_02/src/main.cpp 93.19 ⚠️
trunk/ii002826/task_03/doc/html/index.md

📄 trunk/ii002826/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 93.48 ⚠️
trunk/ii02817/task_03/doc/html/index.md 93.44 ⚠️
trunk/ii02810/task_03/doc/pages/index.md 92.53
trunk/ii002713/task_03/doc/html/index.md 92.26
trunk/ii02823/task_03/doc/html/index.md 92.19
trunk/ii02707/task_04/doc/README.md

📄 trunk/ii02707/task_04/doc/README.md

File Similarity (%)
trunk/ii02817/task_04/doc/README.md 92.88
trunk/ii02707/task_05/doc/README.md

📄 trunk/ii02707/task_05/doc/README.md

File Similarity (%)
trunk/ii02719/task_05/doc/README.md 92.22
trunk/ii02708/task_01/doc/readme.md

📄 trunk/ii02708/task_01/doc/readme.md

File Similarity (%)
trunk/ii02722/task_01/doc/README.md 93.89 ⚠️
trunk/ii02717/task_02/src/main.cpp

📄 trunk/ii02717/task_02/src/main.cpp

File Similarity (%)
trunk/ii002717/task_01/src/main.cpp 93.19 ⚠️
trunk/ii02719/task_01/src/OTIS_task1/OTIS_task1.cpp

📄 trunk/ii02719/task_01/src/OTIS_task1/OTIS_task1.cpp

File Similarity (%)
trunk/ii02719/task_01/src/task1.cpp 94.54 ⚠️
trunk/ii02719/task_01/src/task1.cpp

📄 trunk/ii02719/task_01/src/task1.cpp

File Similarity (%)
trunk/ii02719/task_01/src/OTIS_task1/OTIS_task1.cpp 94.54 ⚠️
trunk/ii02719/task_05/doc/README.md

📄 trunk/ii02719/task_05/doc/README.md

File Similarity (%)
trunk/ii02707/task_05/doc/README.md 92.22
trunk/ii02722/task_01/doc/README.md

📄 trunk/ii02722/task_01/doc/README.md

File Similarity (%)
trunk/ii02708/task_01/doc/readme.md 93.89 ⚠️
trunk/ii02801/task_03/api.md

📄 trunk/ii02801/task_03/api.md

File Similarity (%)
trunk/ii02810/task_03/doc/pages/index.md 94.44 ⚠️
trunk/ii02823/task_03/doc/html/index.md 93.67 ⚠️
trunk/ii002826/task_03/doc/html/index.md 93.48 ⚠️
trunk/ii002713/task_03/doc/html/index.md 92.33
trunk/ii02804/task_03/doc/readme.md

📄 trunk/ii02804/task_03/doc/readme.md

File Similarity (%)
trunk/ii02812/task_03/doc/Readme.md 92.96
trunk/ii02810/task_02/doc/Readme.md

📄 trunk/ii02810/task_02/doc/Readme.md

File Similarity (%)
trunk/ii02810/task_02/test/Test.cpp 92.56
trunk/ii02810/task_02/test/Test.cpp

📄 trunk/ii02810/task_02/test/Test.cpp

File Similarity (%)
trunk/ii02810/task_02/doc/Readme.md 92.56
trunk/ii02810/task_03/doc/pages/index.md

📄 trunk/ii02810/task_03/doc/pages/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 94.44 ⚠️
trunk/ii002713/task_03/doc/html/index.md 92.75
trunk/ii02823/task_03/doc/html/index.md 92.64
trunk/ii002826/task_03/doc/html/index.md 92.53
trunk/ii02812/task_03/doc/report/index.md 92.15
trunk/ii02812/task_03/doc/Readme.md

📄 trunk/ii02812/task_03/doc/Readme.md

File Similarity (%)
trunk/ii02804/task_03/doc/readme.md 92.96
trunk/ii02812/task_03/doc/report/index.md

📄 trunk/ii02812/task_03/doc/report/index.md

File Similarity (%)
trunk/ii02810/task_03/doc/pages/index.md 92.15
trunk/ii02817/task_03/doc/html/index.md

📄 trunk/ii02817/task_03/doc/html/index.md

File Similarity (%)
trunk/ii002826/task_03/doc/html/index.md 93.44 ⚠️
trunk/ii02818/task_03/doc/html/index.md 92.1
trunk/ii02817/task_04/doc/README.md

📄 trunk/ii02817/task_04/doc/README.md

File Similarity (%)
trunk/ii02707/task_04/doc/README.md 92.88
trunk/ii02818/task_03/doc/html/index.md

📄 trunk/ii02818/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02817/task_03/doc/html/index.md 92.1
trunk/ii02823/task_03/doc/html/index.md

📄 trunk/ii02823/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 93.67 ⚠️
trunk/ii02810/task_03/doc/pages/index.md 92.64
trunk/ii002826/task_03/doc/html/index.md 92.19
trunk/ii02824/task_02/src/task_01.cpp

📄 trunk/ii02824/task_02/src/task_01.cpp

File Similarity (%)
trunk/ii02824/task_02/src/task_01.h 93.05 ⚠️
trunk/ii02824/task_02/src/task_01.h

📄 trunk/ii02824/task_02/src/task_01.h

File Similarity (%)
trunk/ii02824/task_02/src/task_01.cpp 93.05 ⚠️

@PTUshnik PTUshnik changed the title [task_02] labwork 2 [task_02] labwork2 Dec 21, 2025
@PTUshnik PTUshnik changed the title [task_02] labwork2 [task_02] Labwork2 Dec 21, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds modular testing for labwork 2, implementing unit tests using Google Test framework for mathematical model functions (linear and non-linear). The submission includes test code, implementation files, build configuration, and documentation with test results and code coverage metrics.

Key Changes

  • Added unit tests for linear and non-linear mathematical model functions using Google Test
  • Implemented two mathematical model functions (linear and non_linear) with corresponding header file
  • Configured CMake build system with Google Test integration
  • Provided documentation with test results and code coverage analysis

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
trunk/ii02824/task_02/test/test.cpp Implements 6 unit tests covering basic cases, zero coefficients, negative inputs, and sinusoidal effects for both linear and non-linear models
trunk/ii02824/task_02/src/task_01.h Declares function prototypes for linear and non_linear mathematical model functions
trunk/ii02824/task_02/src/task_01.cpp Implements the linear and non_linear model functions with mathematical formulas
trunk/ii02824/task_02/src/CMakeLists.txt Configures CMake build with Google Test framework integration and test discovery
trunk/ii02824/task_02/doc/readme.md Documents the lab work with student information, test code, results, and coverage metrics
trunk/ii02824/task_02/doc/images/img1.png Binary image file showing test execution results
trunk/ii02824/task_02/doc/images/img2.png Binary image file showing code coverage analysis

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,53 @@
#define _USE_MATH_DEFINES
#include <gtest/gtest.h>
#include "../src/task_01.h"
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The include path references "task_01.h" but the directory is named "task_02". While this works because the file is in the src directory, this creates confusion. Consider renaming the header and source files to match the task number (task_02) for consistency.

Suggested change
#include "../src/task_01.h"
#include "../src/task_02.h"

Copilot uses AI. Check for mistakes.
Comment thread trunk/ii02824/task_02/src/task_01.cpp Outdated
double non_linear(double y, double& y_p, double u, double a, double b, double c, double d)
{
y_p = y;
return a * y - b * y_p * y_p + c * u + d * std::sin(u);
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non_linear function implementation has a bug. The variable y_p is assigned the value of y on line 10, but then line 11 uses y_p in the calculation (b * y_p * y_p) instead of using y. This means the function computes "a * y - b * y * y" instead of potentially using a previous value of y_p. The test on line 32 expects "b * y * y", which happens to match this implementation, but the parameter y_p should be an input representing the previous value, not just assigned from y. This creates ambiguity about the intended behavior.

Suggested change
return a * y - b * y_p * y_p + c * u + d * std::sin(u);
return a * y - b * y * y + c * u + d * std::sin(u);

Copilot uses AI. Check for mistakes.
Comment thread trunk/ii02824/task_02/src/task_01.h Outdated
Comment on lines +1 to +4
#pragma once

double linear(double y, double u, double a, double b);
double non_linear(double y, double& y_p, double u, double a, double b, double c, double d); No newline at end of file
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is named "task_01.h" but is located in the task_02 directory. This naming inconsistency could cause confusion. Consider renaming to "task_02.h" to match the task directory.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +12
#include <cmath>

double linear(double y, double u, double a, double b)
{
return a * y + b * u;
}

double non_linear(double y, double& y_p, double u, double a, double b, double c, double d)
{
y_p = y;
return a * y - b * y_p * y_p + c * u + d * std::sin(u);
} No newline at end of file
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is named "task_01.cpp" but is located in the task_02 directory. This naming inconsistency could cause confusion. Consider renaming to "task_02.cpp" to match the task directory.

Copilot uses AI. Check for mistakes.
<br><br><br><br><br>
<p align="right">Выполнил:</p>
<p align="right">Студент 2 курса</p>
<p align="right">Группы ИИ-28</p>
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation refers to "Группы ИИ-28" (Group II-28) but the directory path indicates ii02824. While the student may be from group II-28, this inconsistency should be verified to ensure the documentation matches the actual student identifier.

Suggested change
<p align="right">Группы ИИ-28</p>
<p align="right">Группы ИИ-28 (ii02824)</p>

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 21, 2025 15:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +4
double linear(double y1, double u1, double a1, double b1);
double non_linear(double y1, double& y1_p1, double u1, double a1, double b1, double c1, double d1); No newline at end of file
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter names use a '1' suffix (e.g., y1, u1, a1) which is unnecessary and reduces readability. Consider renaming to more conventional names like y, u, a, b, etc., which would match the test code and improve clarity.

Suggested change
double linear(double y1, double u1, double a1, double b1);
double non_linear(double y1, double& y1_p1, double u1, double a1, double b1, double c1, double d1);
double linear(double y, double u, double a, double b);
double non_linear(double y, double& y_p1, double u, double a, double b, double c, double d);

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.14)
project(my_project)
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name 'my_project' is generic and non-descriptive. Consider using a more meaningful name like 'task_02_models' or 'labwork2' that reflects the actual purpose of the project.

Suggested change
project(my_project)
project(task_02_models)

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +35
my_tests1
${CMAKE_CURRENT_SOURCE_DIR}/task_01.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../test/test.cpp
)

target_include_directories(my_tests1 PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../src
${CMAKE_CURRENT_SOURCE_DIR}/../test
)

target_link_libraries(
my_tests1
GTest::gtest_main
)

include(GoogleTest)
gtest_discover_tests(my_tests1) No newline at end of file
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The executable name 'my_tests1' is non-descriptive. Consider a more meaningful name like 'model_tests' or 'task_01_tests' that better describes what is being tested.

Suggested change
my_tests1
${CMAKE_CURRENT_SOURCE_DIR}/task_01.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../test/test.cpp
)
target_include_directories(my_tests1 PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../src
${CMAKE_CURRENT_SOURCE_DIR}/../test
)
target_link_libraries(
my_tests1
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(my_tests1)
task_01_tests
${CMAKE_CURRENT_SOURCE_DIR}/task_01.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../test/test.cpp
)
target_include_directories(task_01_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../src
${CMAKE_CURRENT_SOURCE_DIR}/../test
)
target_link_libraries(
task_01_tests
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(task_01_tests)

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 21, 2025 15:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +4
double linear(double y1, double u1, double a1, double b1);
double non_linear(double y1, double& y1_p1, double u1, double a1, double b1, double c1, double d1); No newline at end of file
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable names in the header file use inconsistent suffixes. The parameters are named y1, y1_p1, u1, a1, b1, c1, d1, but based on the context and usage in tests, these should represent generic parameters, not specifically "1"-indexed values. Consider using more descriptive names like 'y', 'y_prev', 'u', 'a', 'b', 'c', 'd' to avoid confusion with the test variable naming convention.

Suggested change
double linear(double y1, double u1, double a1, double b1);
double non_linear(double y1, double& y1_p1, double u1, double a1, double b1, double c1, double d1);
double linear(double y, double u, double a, double b);
double non_linear(double y, double& y_prev, double u, double a, double b, double c, double d);

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants