Improve testing for Animal Magic Exercise #2734
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had a conversation with my mentor exercise, Animal Magic, about the tests for the exercise.
I have pasted some of my observations/questions, and added an in my eyes, improved and more correct test.
Me:
Mentor:
Me:
Mentor:
Me:
So long story short, I think the solutions, my solution, with the
return rand.Intn(19) + 1
are incorrect, and my new improved tests will show that. The tests will now "ensure" more than before that all numbers are rolled, still within the scope of 1-20. Of course, there is still a small statics possibility that e.g. 20 is never rolled on 100 rolls.I can of course be completely wrong as I'm new to go, but would be happy to discuss this, so that we can get an improved code base.
Let me know what you think.