-
Notifications
You must be signed in to change notification settings - Fork 23
Reforestation (additional task) #26
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?
Reforestation (additional task) #26
Conversation
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.
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; |
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.
warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
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; |
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.
warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
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; |
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.
warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]
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}}; |
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.
warning: variable 'forest_1' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]
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); |
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.
warning: variable 'result_1' of type 'int' can be declared 'const' [misc-const-correctness]
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); |
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.
warning: variable 'result' of type 'int' can be declared 'const' [misc-const-correctness]
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}}; |
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.
warning: variable 'forest' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]
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); |
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.
warning: variable 'result' of type 'int' can be declared 'const' [misc-const-correctness]
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}, |
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.
warning: variable 'forest' of type 'std::vector<std::vector>' can be declared 'const' [misc-const-correctness]
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); |
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.
warning: variable 'result' of type 'int' can be declared 'const' [misc-const-correctness]
int result = RecoverForest(forest, unrecovered); | |
int const result = RecoverForest(forest, unrecovered); |
No description provided.