Skip to content
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

tests: Add test in cycle_sort.cpp #1520

Merged
merged 11 commits into from
Jul 13, 2021
Merged

tests: Add test in cycle_sort.cpp #1520

merged 11 commits into from
Jul 13, 2021

Conversation

Swastyy
Copy link
Contributor

@Swastyy Swastyy commented Jun 29, 2021

Description of Change

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

@Swastyy Swastyy closed this Jun 29, 2021
@Swastyy Swastyy reopened this Jun 29, 2021
@Swastyy
Copy link
Contributor Author

Swastyy commented Jun 29, 2021

@Panquesito7 Sorry for taking your time in the same kind of file edit/PR again. Its because I contributed for the first time and just to get updates from the master repo to forked repo I forked it again. But I assure you that it won't take long for this PR since you already approved it and I have used the same code as before basically re-created the pull request.

@Panquesito7 Panquesito7 added the enhancement New feature or request label Jul 2, 2021
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

That's the only thing missing! After that, I'll approve this PR. 🙂

* @brief Implementation of [Cycle
* sort](https://en.wikipedia.org/wiki/Cycle_sort) algorithm
*
* @brief Implementation of [Cycle sort](https://en.wikipedia.org/wiki/Cycle_sort) algorithm
Copy link
Member

Choose a reason for hiding this comment

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

I'd like you to put this back as it was (same in lines 5 and 21).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are currently 1-line descriptions.

Copy link
Member

@mishraabhinn mishraabhinn left a comment

Choose a reason for hiding this comment

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

Reference
Do this contribution is some different. We already have a cycle_sort. @Panquesito7

@Swastyy
Copy link
Contributor Author

Swastyy commented Jul 5, 2021

Reference
Do this contribution is some different. We already have a cycle_sort. @Panquesito7

Reference
Do this contribution is some different. We already have a cycle_sort. @Panquesito7

https://github.com/TheAlgorithms/C-Plus-Plus/projects/6#card-63413841

sorting/cycle_sort.cpp Outdated Show resolved Hide resolved
sorting/cycle_sort.cpp Outdated Show resolved Hide resolved
sorting/cycle_sort.cpp Outdated Show resolved Hide resolved
sorting/cycle_sort.cpp Outdated Show resolved Hide resolved
@Swastyy
Copy link
Contributor Author

Swastyy commented Jul 6, 2021

Hey, after committing the above suggestions I got mail as Run failed: CodeQL... but here everything is working fine. Isn't it?

@mishraabhinn
Copy link
Member

Hey, after committing the above suggestions I got mail as Run failed: CodeQL... but here everything is working fine. Isn't it?

Is it working now?

@Swastyy
Copy link
Contributor Author

Swastyy commented Jul 6, 2021

Hey, after committing the above suggestions I got mail as Run failed: CodeQL... but here everything is working fine. Isn't it?

Is it working now?

Yea, I think so. 😕
Like git bot has pushed it so there aren't any issues.

@mishraabhinn
Copy link
Member

Hey, after committing the above suggestions I got mail as Run failed: CodeQL... but here everything is working fine. Isn't it?

Is it working now?

Yea, I think so. 😕
Like git bot has pushed it so there aren't any issues.

If you got mail there is issue. Something went wrong. Go to workflow and see the error.

@@ -98,9 +98,9 @@ static void test() {
std::cout << "passed" << std::endl;

// [4.3, -6.5, -7.4, 0, 2.7, 1.8] return [-7.4, -6.5, 0, 1.8, 2.7, 4.3]
std::vector<double> array2 = {4.3, -6.5, -7.4, 0, 2.7, 1.8};
std::vector<int> array2 = {4.3, -6.5, -7.4, 0, 2.7, 1.8};
Copy link
Member

Choose a reason for hiding this comment

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

Why int ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry 1 sec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

20 minutes and no mail yet 😕

@Swastyy
Copy link
Contributor Author

Swastyy commented Jul 8, 2021

@mishraabhinn errors resolved 😃

@Panquesito7 Panquesito7 changed the title Update cycle_sort.cpp tests: Add test in cycle_sort.cpp Jul 9, 2021
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Almost there! 😄

sorting/cycle_sort.cpp Outdated Show resolved Hide resolved
sorting/cycle_sort.cpp Outdated Show resolved Hide resolved
@Swastyy Swastyy requested a review from Panquesito7 July 10, 2021 07:28
Panquesito7
Panquesito7 previously approved these changes Jul 11, 2021
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you for your contribution! 👍 🎉

@Panquesito7 Panquesito7 added the approved Approved; waiting for merge label Jul 11, 2021
suprithars111
suprithars111 previously approved these changes Jul 11, 2021
Copy link
Member

@ayaankhan98 ayaankhan98 left a comment

Choose a reason for hiding this comment

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

Earlier approval by mistake.

test.cpp: In instantiation of ‘std::vector<T> sorting::cycle_sort::cycleSort(const std::vector<T>&) [with T = unsigned int]’:
test.cpp:96:64:   required from here
test.cpp:53:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   53 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:59:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   59 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:65:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   65 |         while (pos != cycle_start) {
      |                ~~~~^~~~~~~~~~~~~~
test.cpp: In instantiation of ‘std::vector<T> sorting::cycle_sort::cycleSort(const std::vector<T>&) [with T = double]’:
test.cpp:103:62:   required from here
test.cpp:53:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   53 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:59:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   59 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:65:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   65 |         while (pos != cycle_start) {
      |                ~~~~^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

shell returned 1

@Swastyy Swastyy dismissed stale reviews from suprithars111 and Panquesito7 via 6a57901 July 12, 2021 09:46
@Swastyy
Copy link
Contributor Author

Swastyy commented Jul 12, 2021

Earlier approval by mistake.

test.cpp: In instantiation of ‘std::vector<T> sorting::cycle_sort::cycleSort(const std::vector<T>&) [with T = unsigned int]’:
test.cpp:96:64:   required from here
test.cpp:53:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   53 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:59:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   59 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:65:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   65 |         while (pos != cycle_start) {
      |                ~~~~^~~~~~~~~~~~~~
test.cpp: In instantiation of ‘std::vector<T> sorting::cycle_sort::cycleSort(const std::vector<T>&) [with T = double]’:
test.cpp:103:62:   required from here
test.cpp:53:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   53 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:59:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   59 |         if (pos == cycle_start) {
      |             ~~~~^~~~~~~~~~~~~~
test.cpp:65:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   65 |         while (pos != cycle_start) {
      |                ~~~~^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

shell returned 1

Sorry for this have changed the data type of iterators.

Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

All fine for me. I'll merge this now. If anybody finds any objections, please make another PR to fix them. Thanks! 😄

@Panquesito7 Panquesito7 merged commit 82290e7 into TheAlgorithms:master Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved; waiting for merge enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants