Skip to content

saddle-points: Add tests for non-square matrices (NxM) #1288

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

Merged
merged 6 commits into from
Aug 8, 2018

Conversation

Alexhans
Copy link
Contributor

@Alexhans Alexhans commented Aug 7, 2018

The saddle-points exercise made no indication that it was just for NxN matrices but tests for NxM matrices were non-existent.

I added the tests and made the description more explicit in relation to non-square matrices.

closes #1276

There's no indication in the description that non square matrices (NxM)
are not covered in the provided saddle points definition.

Now the tests reflect that.
@@ -21,5 +21,7 @@ A matrix may have zero or more saddle points.
Your code should be able to provide the (possibly empty) list of all the
saddle points for any given matrix.

The matrix can have different a number of rows and columns (Non square).
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be:
The matrix can have a different number of rows and columns (non-square).

@Alexhans
Copy link
Contributor Author

Alexhans commented Aug 7, 2018

Hi, @cmccandless

I made the change you requested by amending the commit and forcing the push. I could've made another commit but then I probably would've had to squash the commits for a cleaner history and still have to use force again.

Was this the right approach? It seems problematic in the sense that we can no longer see the file you were requesting me to change.

@cmccandless
Copy link
Contributor

@Alexhans

Generally, force-pushing is not the best practice (but it does have its uses).

The best approach in this case is usually to go ahead and simply make another commit. There is a "Squash and merge" option for maintainers to keep the master branch commit history clean, so contributors generally don't have to worry about squashing their own PRs.

Copy link
Member

@rpottsoh rpottsoh left a comment

Choose a reason for hiding this comment

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

Fix the indenting. I still need to confirm that "expected" satisfies "input". In all likely hood it does, just want to be thorough.

"row": 0,
"column": 3
}
]
Copy link
Member

Choose a reason for hiding this comment

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

A cosmetic request. Please adjust your indentation spacing to conform to the other test cases.

}
Copy link
Member

Choose a reason for hiding this comment

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

Technically this is an unrelated change. If you can undo this that would be great, or move to a separate commit. Watch out for this going forward. This won't prevent me from accepting.

}

Copy link
Member

Choose a reason for hiding this comment

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

blank line not needed.

@Alexhans
Copy link
Contributor Author

Alexhans commented Aug 7, 2018

I forgot to change credentials. I'm going to have to force update with the proper ones.

@rpottsoh
Copy link
Member

rpottsoh commented Aug 7, 2018

@Alexhans another good habit to get in to would be to create a branch within your fork that contains the changes of your PR, rather than working off your master. Don't worry about this for this PR.

I am not sure what credentials you need to change.

@Alexhans Alexhans closed this Aug 7, 2018
@Alexhans
Copy link
Contributor Author

Alexhans commented Aug 7, 2018

@Alexhans another good habit to get in to would be to create a branch within your fork that contains the changes of your PR, rather than working off your master. Don't worry about this for this PR.

@rpottsoh: Yes. That sounds like a good idea. Not trying to rush things either.

I am not sure what credentials you need to change.

The issue was committing with the wrong user.email/user.name (I have 2 aliases to set up my local config and absentmindledly used the wrong one after cloning my fork).

Thanks for the patience. I'll take these things into consideration for future pull requests.

@rpottsoh
Copy link
Member

rpottsoh commented Aug 7, 2018

Overall you have done a great job. 👍 We are only nit picking some pretty minor things. I see that you have closed this PR. Are you intending to open another with your other set of credentials?

@Alexhans
Copy link
Contributor Author

Alexhans commented Aug 7, 2018

@rpottsoh: Oh, no. This one is the one I intend to merge. I've fixed the user.name and user.email on the commits already.

@Alexhans Alexhans reopened this Aug 7, 2018
@rpottsoh rpottsoh merged commit 8d6f2d3 into exercism:master Aug 8, 2018
@rpottsoh
Copy link
Member

rpottsoh commented Aug 10, 2018

@Alexhans is there significance to the order of expected coordinates in case Can identify saddle points in a non square matrix? I am working on an example solution which computes the correct coordinates for the two saddle points. However, the points found are in (0,0), (0,2) order, opposite as you have indicated in the testdata.

For the time being I am going to assume the order is not important. If it isn't then a comment or some other modification should be made to the testdata.

@cmccandless
Copy link
Contributor

If the order of the points is actually relevant, the list of points ought to be sorted (probably in ascending order).

@rpottsoh
Copy link
Member

The order of the coordinate pairs is opposite that of the other tests that have more than one saddle-point. There is nothing stated in the README or in the testcase about order. To me the order shouldn't be relevant. I think in most cases a solution is going to start at (0,0) when looking for valid points.

As long as the number of actual points agrees with the number of expected points and each actual point matches each expected point, that should be enough.

  • Should the docs be updated to specify ascending order?
    This is likely the least disruptive to testsuite design.
  • Should the docs be updated to specify any order?
    This would require the testsuites to compare each actual pair against every expected pair and be satisfied with equality regardless of position of each in a list / array structure.
  • Should this conversation be moved to a new issue?

@cmccandless
Copy link
Contributor

Should this conversation be moved to a new issue?

I think so, yes.

@rpottsoh
Copy link
Member

This conversation has been moved to #1294.

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.

saddle-points: Clarify it's NxN matrices or add NxM test cases
3 participants