7 kyu
RaNDoM CAsE
1,127 of 2,272treffynnon
Loading description...
Fundamentals
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.
Node 18. should be enabled
Test.expect
should be abortedAssertions that do not test anything should be removed, like this one:
Description should be language-agnostic
should be
python new test framework is required. updated in this fork
Approved
Ruby 3.0 should be enabled.
Enabled in this fork
I updated the Ruby tests:
This comment has been hidden.
Check this about the code markdown.
Do you have some detail on the test results you're getting? What's failing specifically?
sample: tHese guIdElineS aRe deSIgneD tO Be CompAtiBle wItH joe cELKO’s sql prOGraMming StYLe boOk
Expected: true Actual: false
for sample test case.
Also I am not pretty sure if my code does what I meant.
this was meant to give random number every iteration, and therefore create random case. But when I recompile my program I see, that in every single compilation those numbers, are exactly the same. Like drawing them happens only one time. Therefore my "random case" is random only for first compilation, and then it looks exactly the same after another compilations. At least it looks like in my OS - Mint, GCC 5.4.0
phh, I guess I have to find another way to generate "random" numbers ;]
.
This comment has been hidden.
Because your function does not
return
a thing: try to do that instead ofprint
ing...c++ translation pending as well as the Crystal one :)
Weird I didn't get notified about the crystal one so thanks for the link. Is there some way to see all the kumite against a given kata?
There are no tests to assess if the string is actually random; you can just lower case characters each
x < 50%
times and upper the rest to pass test in Python (I think JS is not too far).This comment has been hidden.
So in fact you've redefined the meaning of "random". It's like saying if I flip a coin 10 times and get 9 heads then it wasn't random. But it was!
Maybe Kata description should say: "toggle the case of at least 9 characters"...
@dinglemouse Meh. It's open to collaborators, so please feel free to do better than me.
I can still make it if I substitute each X characters and that proves little in terms of reliability; did you check my Ruby (thanks for the approval!) or Crystal code? Even if you are not familiar with them, they should be rather readable.
@GiacomoSorbi - I cannot see the difference between what you're doing in Ruby and Crystal versus the tests mentioned above - they're both going to fail @dinglemouse tossing as far as I can see. Am I missing something?
I don't think I might explain it better than dingle: would you consider random to return exactly the same string, all lower- or all upper-case?
They would all be correct results, but that is not how you test the function.
I agree that where a random is involved that it is perfectly valid (however unlikely) for all results to be same, all uppercase and all lowercase. What I am unclear on is how this can be tested any better? That's what I am interested to hear more about. Is there something you did in your tests that I am missing or not understand this attempts to mitigate this issues?
First test is similar to yours, to test if both expected and source strings are the same, once all uppercased.
Then I create an array (or vector, in c++) with the first result, try to generate and add (but only if already not included before) 9 different results in it and check if the final length is > 8 (thus I live room for one possible random repetition of the same result).
OK, I am pretty sure the tests for JS are doing that already.
Not really: the function
randomCheck
tries to measure that in a more naive and inefficient way, char by char too many times.Coffescript translation Kumited! please Accept :D
'alr approved some time ago'
Hello,
Whatever I seem to do I get this error message:
"TypeError: Object o has no method 'toLowerCase'"
Even when I don't use the 'toLowerCase' method.
Can anyone help?
Are you returning an object instead of a string? Post your code - marking it as a spoiler - and I'll try to help.
Thanks for replying, had another go this evening and figured it out for myself! (but you were right, I was returning the wrong thing)
This comment has been hidden.
This comment has been hidden.