7 kyu
Player Contact Manager
500 of 962IanEarley
Loading description...
Arrays
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Nice kata! Thanks to everyone who contributed to it.
JavaScript translation. Please, review and approve.
Added :)
What is the sense of passing
null
instead of an empty string? If anything, the function should be called asplayerManager()
, which would more or less passundefined
, notnull
.Passing
null
is an inappropriate construct from a different language ( C and friends seem to pass null pointers this way. it makes no sense in JavaScript though ).The semantic of
undefined
in JS means nothing is even passed (judging from how it usually appears and how it interacts with other language features).null
in typed language (especially OOP languages) usually meansbottom
. So it really depends on what this input validation is even supposed to mean. Is the input not provided, or is it abottom
that is created by the caller's code?Also, empty string results in empty array is the natural behaviour, I'm not sure why it's mentioned in the first place.
Python translation kumited -- please check and approve
.
The whole test suite is rubbish:
Just as I reported below ;-)
Thanks for taking a look, I'm not sure exactly how to do random tests yet for this so I've taken them out for now until I can figure out a good way to do them! Thanks for the feedback!
I'll try adding random tests myself if you don't mind.
Oh thank you! Yeah I'd be happy for the help :)
Added random tests in Ruby. Increased number of tests in Python and also improved the random generator.
Approved now.
Thanks for your contribution!
Use
Test.assert_equals
instead ofTest.expect
(otherwise this happens)I also suggest to add more random tests (e.g. 50) and make them more random (random number of entries)
[edit] see python translation for a better test suite
I see, sorry I'm still somewhat new and this is my first kata so any feedback is good feedback!
Thanks for the suggestions, I'll make the changes to the test cases!
Sample tests: it's
Test.assert_equals
, notTest.assert_equal
.Woops! Got that fixed, thank you and good catch!