Skip to content

Conversation

Stargazer2005
Copy link

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 15 out of 56. Check the log or trigger a new build to see more.


void PrintResult(int result,
const std::vector<std::pair<int, int>>& unrecovered) {
std::cout << "Time: " << result << std::endl;

Choose a reason for hiding this comment

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

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
std::cout << "Time: " << result << std::endl;
std::cout << "Time: " << result << '\n';

const std::vector<std::pair<int, int>>& unrecovered) {
std::cout << "Time: " << result << std::endl;
if (result == -1) {
std::cout << "Unrecovered chunks at indices:" << std::endl;

Choose a reason for hiding this comment

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

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
std::cout << "Unrecovered chunks at indices:" << std::endl;
std::cout << "Unrecovered chunks at indices:" << '\n';

std::cout << "Unrecovered chunks at indices:" << std::endl;
for (const auto& p : unrecovered)
std::cout << "(" << p.first << ", " << p.second << ") ";
std::cout << std::endl;

Choose a reason for hiding this comment

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

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
std::cout << std::endl;
std::cout << '\n';

}

int main() {
std::vector<std::vector<int>> forest_1 = {{2, 1, 0}, {1, 1, 1}, {0, 1, 2}};

Choose a reason for hiding this comment

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

warning: variable 'forest_1' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]

Suggested change
std::vector<std::vector<int>> forest_1 = {{2, 1, 0}, {1, 1, 1}, {0, 1, 2}};
std::vector<std::vector<int>> const forest_1 = {{2, 1, 0}, {1, 1, 1}, {0, 1, 2}};

int main() {
std::vector<std::vector<int>> forest_1 = {{2, 1, 0}, {1, 1, 1}, {0, 1, 2}};
std::vector<std::pair<int, int>> unrecovered_1;
int result_1 = RecoverForest(forest_1, unrecovered_1);

Choose a reason for hiding this comment

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

warning: variable 'result_1' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int result_1 = RecoverForest(forest_1, unrecovered_1);
int const result_1 = RecoverForest(forest_1, unrecovered_1);

TEST(RecoverForestTests, SingleRowMixedStates) {
std::vector<std::vector<int>> forest = {{2, 1, 0, 1, 2}};
std::vector<std::pair<int, int>> unrecovered;
int result = RecoverForest(forest, unrecovered);

Choose a reason for hiding this comment

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

warning: variable 'result' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int result = RecoverForest(forest, unrecovered);
int const result = RecoverForest(forest, unrecovered);


// Test Case 2: Single Column with All Preserved
TEST(RecoverForestTests, SingleColumnAllPreserved) {
std::vector<std::vector<int>> forest = {{2}, {2}, {2}, {2}};

Choose a reason for hiding this comment

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

warning: variable 'forest' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]

Suggested change
std::vector<std::vector<int>> forest = {{2}, {2}, {2}, {2}};
std::vector<std::vector<int>> const forest = {{2}, {2}, {2}, {2}};

TEST(RecoverForestTests, SingleColumnAllPreserved) {
std::vector<std::vector<int>> forest = {{2}, {2}, {2}, {2}};
std::vector<std::pair<int, int>> unrecovered;
int result = RecoverForest(forest, unrecovered);

Choose a reason for hiding this comment

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

warning: variable 'result' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int result = RecoverForest(forest, unrecovered);
int const result = RecoverForest(forest, unrecovered);


// Test Case 3: Large Grid with Multiple Isolated Parts
TEST(RecoverForestTests, LargeGridMultipleIsolatedParts) {
std::vector<std::vector<int>> forest = {{0, 0, 2, 0, 0},

Choose a reason for hiding this comment

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

warning: variable 'forest' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]

Suggested change
std::vector<std::vector<int>> forest = {{0, 0, 2, 0, 0},
std::vector<std::vector<int>> const forest = {{0, 0, 2, 0, 0},

{2, 0, 0, 1, 0},
{0, 0, 0, 0, 2}};
std::vector<std::pair<int, int>> unrecovered;
int result = RecoverForest(forest, unrecovered);

Choose a reason for hiding this comment

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

warning: variable 'result' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int result = RecoverForest(forest, unrecovered);
int const result = RecoverForest(forest, unrecovered);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant