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

Simulator is sorting numbers as strings #262

Closed
mrflip opened this issue Dec 6, 2017 · 3 comments · Fixed by atesgoral/hrm-level-outbox-generator#3
Closed

Simulator is sorting numbers as strings #262

mrflip opened this issue Dec 6, 2017 · 3 comments · Fixed by atesgoral/hrm-level-outbox-generator#3

Comments

@mrflip
Copy link

mrflip commented Dec 6, 2017

The simulator is incorrectly showing sort solutions as failing, because it is sorting 10 before 2:

input:
[ 7, 10, 6, 6, 5, 7, 6, 2, 4, 0, 'M', 'K', 'R', 'W', 0, 3, 2, 5, 5, 10, 3, 6, 5, 7, 8, 0 ]
expected:
[ 10, 2, 4, 5, 6, 6, 6, 7, 7, 'K', 'M', 'R', 'W', 10, 2, 3, 3, 5, 5, 5, 6, 7, 8 ]
actual:
[ 2, 4, 5, 6, 6, 6, 7, 7, 10, 'K', 'M', 'R', 'W', 2, 3, 3, 5, 5, 5, 6, 7, 8, 10 ]

One solution is to remove 10 from the test pool. Another is to fix the problem.

@sniperrifle2004
Copy link
Contributor

I feel I should mention I created this issue a while ago: atesgoral/hrm-level-outbox-generator#1
with a corresponding pull request, when I noticed my sort programs were failing tests. It only provides a fix for 41.

mrflip pushed a commit to mrflip/hrm-level-outbox-generator that referenced this issue Dec 6, 2017
Level 4 should swap entries, not sort them. The other levels need to handle sorts differently for ints and strings because Javascript derp.
Fixes atesgoral#1 and atesgoral/hrm-solutions#262
@mrflip
Copy link
Author

mrflip commented Dec 6, 2017

You are correct – I didn't notice the issue or the PR, should have checked over there first. I put in a PR that addresses 4, 28 and 41 before seeing this.

mrflip pushed a commit to mrflip/hrm-level-outbox-generator that referenced this issue Dec 6, 2017
Level 4 should swap entries, not sort them. The other levels need to handle sorts differently for ints and strings because Javascript derp.
Fixes atesgoral#1 and atesgoral/hrm-solutions#262
@atesgoral
Copy link
Owner

OMG. I just saw this now. My apologies.

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 a pull request may close this issue.

3 participants