Retired
Greeting My Friends (retired)
415 of 1,582bilalDjago
Loading description...
Fundamentals
Arrays
Data Types
Lists
Data Structures
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.
In Java, the singleArg test is not working because it is testing a String instead of testing an array of String...
Tests do not execute properly because of some syntax error on their implementation.
Test Cases for Ruby translation are completely broken, didn't really want to spend the time and energy to debug, but I'm about 99% sure the problem is in the third line of the test cases.
the
singleArg
test case is brokenHey, there is one thing to correct in Ruby version's tests. In the
expected
, I have changed to the following argument so the test could work!greeting_for_all_friends(["Bilal"]).nil?
correct tests in java please
Testcase for singleArg ist not possible for Java due to return-type.
For Ruby, the "expect" test in the provided Tests has syntax errors.
function greetingForAllFriends(friends){ if(friends[index]!==null && friends!==null){ return("Hello, "+""+friends+"!")// ... } else {return null}}
say's index is not defined in the function???
The message is self-explanatory. You did not define the "index" variable.
error in java test case
Third test case on Ruby seems to have an issue
Tests should contain next check: if array isn't containing valid strings greeting function should return null
syntax error in test cases
Cannot pass the single item test. Give "Ljava.lang.String;@" error. It seems a string is expected (but the method must return a String[].
Seems to be incorrect, test cases fail.
Typos in the text
Can't finish it, I do the last test right but it doesn't pass
test case fails
Test cases fail, even though code is correct and final submission is successful
Third test case is broken
Minor spelling error in the instructions.
One of the test cases expecting String, instead of array.
As the way the question is posed, it seems like the expected result is always a String[], yet the test case expects a String in one instance.
Single argument provided test did not pass - passed when submitted with no problems.
Typo: "random tests" instead of "randm tests"
Test case has string instead of string array.
Wrong syntax in one of the ruby tests.
Suggested fix: Test.assert_not_equals(greeting_for_all_friends(["Bilal"]), nil, "Must not return nil for an input")
Tests case raising an error on valid code
The test program has strange errors
SingleArg testcase in Java is wrong
Ruby: "is not nil" test case is invalid syntax.
example tests not set up properly
I clicked Run test and test failed despite the fact i got good solution. Accidentaly pressed "CTRL + S" and the test went through.
test case with 1 arg not working: he is expecting a string instead of an array
It has an error in the unit test Single Arg expect an String when the function returns an array of strings
None of the test cases pass with correct solutions (even with the top solution from the solutions page pasted in and run).
Test method singleArg() is wrong in Java
ruby example test syntax is broken
one of test cases is incorrect, but on submit is fine..
Ruby testcases have syntax errors!
Incorrect test case for single item array in Java; expected result is a String, but method returns String[].
The ruby version has some issues from what I guess is a poor translation of a python kata:
the test case checking the output containing the greeting was not formatted correctly
There's an error on one of the Test Case
tests didn't work :(
"Implement a method..."
This is a typo as it's not a method, it's function. It also refers to it as a method again later on.
There are NO FUNCTIONS in ruby I am told. It's a method.
The third case have and issue.
This comment has been hidden.
The provided test cases need to be error checked. In the third case, the test case looks for a String return value not an array.
There are a few grammatical issues in the description:
"We give you an Array of friend's list." (should say "We give you an array of friends.")
This method takes an array of friends name and return a greeting messages Array. (should say "This method takes an array of friends' names and returns a greeting messages Array.")
If the argument is a valide array of strings... (should say "If the argument is a valid array of strings...")
The last case seems to be wrong in Java. It expects a string while the method returns an array of strings and when the test prints this array it actually prints its memory address so this test will never be passed.
The last test case doesnt have the right syntax in Java
This comment has been hidden.
A few minor notes (Python): an array is called a list in python, and the kata asks for a function - not a method. Other than that, nice kata.
Since the kata is available in Ruby, the tests should work in Ruby.
At least the initial tests yield a syntaxt error. Interestingly the 'final' tests are working fine.
The 3 provided test case has some syntax errrors, throwing an error when you try to run it. I'm still figuring out Ruby, so I'm not really sure what they are.
Spelling issues in tests. "Mast" -> "Must" Unclear instructions for null / 0 size input.
Instructions unclear regarding behavior if returning "None".
The singleArg() test case is incorrect, checking for "Hello, Bilal!", when, in fact, it should be checking for an array of size one containing the string, "Hello, Bilal!". This yields a type mismatch error since the function is always to return an object of type String[] but your test case is looking for type String.
Third test has a syntax error.
The test singleArg is incorrect, instead of:
assertEquals(greetings.greetingForAllFriends("Bilal"), "Hello, Bilal!");
it should be:
assertArrayEquals(greetings.greetingForAllFriends("Bilal"), new String[]{"Hello, Bilal!"});
I'm a little bit confused. My program fails on test cases, but succedes when submitted. I'm using java language and it fails with a single argument. It looks like you are testing if i return a single string instead of reading from array.
Ruby tests have a syntax error
Some editing/proofreading for the description would be helpful, some of the language is confusing though it is informationally accurate.
test code does not test for correct return type.
Could you elaborate? What language are you using.. could you also provide your code below and mark it as having spoiler content, thanks!
I assumed that when I left a comment that it would be tagged with where I was when I made the comment. I was in Java. The test code doesn't work
The test case is not correct
I'm very new at this
Starting tests do not compile
This comment has been hidden.
The instructions are a bit unclear, which makes determining the right output difficult. The last rule is "If the argument is a valide array of string, the method should return a hello message for every array entry". However, the method actually requires you to return an ARRAY including the appropriate hello messages/names, not the messages themselves. This could be made clearer in the instructions.
Test cases in Ruby are wrong.
This comment has been hidden.
The test is not good. We have to edit the test function. But the issue is easy to find out
This comment has been hidden.
it creates a new array with the result of calling given function on every element of this array. Which it will add "Hello" + your arguments + "!"
Thanks!
The second test case is broken ? (Result : singleArg(GreetingsTest)expected:<[Ljava.lang.String;@264e7a17> but was:) My solution: public String[] greetingForAllFriends(String... friends) { if((friends != null) && (friends.length != 0)){ if(friends.length == 1){ if(friends[0].equals("")) return null; } List list = new ArrayList(); for(String s : friends){ list.add("Hello, " + s + "!"); } String [] tmp = list.toArray(new String[list.size()]); return tmp; } return null; }
One of the Ruby example test cases is broken
Test with oneArg was failed every time i run it from button "run tests". But from "submit" button everything works fine
This comment has been hidden.
This comment has been hidden.
some slightly unclear grammar in the instructions. Nothing too major, but have a read over it and see if you can clarify some parts.
There is a syntax error in the tests for the Ruby version. "is not nil" should instead be "!= nil". Thanks for sharing the kata though.
too many random tests that all test the same thing the example 'expect' test does not work
Assertion for singleArg is expecting a String rather than String[], so test wil always fail unless modified
Translated into Ruby, if you wish to approve it :)
Also, I added random tests: feel free to just ask in case you want them into the JS and Python versions too :)
CoffeeScript translation published.
Test-Case is wrong. Change description so that the user know, that he maybe has to change the test-case or fix test-case.
singeArg test failed, although final submit succeeded
Work more on test cases. SingleArg test is wrong.
Problem
As the kata is currently, it has the following sample unit test:
As the method signature is only defined for
String[]
and notString
, the comparison will always fail.Suggested Fix
The Python description is confusing at least because there is no signature following "Write a method called greetingForAllFriends, with this signature:".
"Array" with a capital "A" also has no meaning in Python as it does in Java.
Typo: "array of friends name" -> "array of friends' names"
Generally the grammar of the description could be improved as well.
I would make the description about the output for a given list of multiple names more clear. One could also think to return a concatenated string instead of a list of strings.
SingleArg test test for string when return is string array.
The java test case "single argument" is wrong. I guess it should be an array of string and it is just a string.
JS translation kumited.
(Description modified)
Hi, I've added a Python translation, if you want to approve it, instructions for the approval process are here.
The unit tests did not provide aduquate feedback on the actual formatting.
I forgot the trailing "!" and it was pretty hard to see what was lacking since the "before submit" tests did not check for the actual formatting.
Also, the messages did not contain expected/actual values. But as I am new to this platform, I am not sure if it is an issue with codewars itself or these unit tests.
Spelling and grammar issues with the test cases. The bottom most case kind of implies that it should both return null and something non-null (but you can reasonably assume that this is a mistake and you should return something non-null).
There is no test with values in the test-case part
Failure messages did not specify precisely why the test failed. I forgot the ! symbol at the end of the greetings string. It did not indicate that to me.
-- I think it would be helpful to include another example explaining a case of multiple friends, or at least including the phrase "for each friend".
Maybe this is how it always is but the test case feedback is lacking as to what the problem might actually be. But besides that it is good.
some test cases when i try to sumbit are faulty!
There're grammatical errors: "Must" is spelled is "Mast".
I updated the formatting of the description to use markdown.
Thank you jhoffner
The description should give a little bit more information
notNullArgs
shows as passed even though the return value is not correct. In my case, I was returning "Hello, Bilal" instead of "Hello, Bilal!" and it was showing as passed.How am I failing the
testRealValues(GreetingsTest)
test? The error message isarrays first differed at element [0]; expected: but was:
, and by printing the input and output, I've got the following:Resolved; I was missing the punctuation. This, however, now leads to a couple more issues (see above).
The strings in the provided test cases need some cleaning up for grammar and spelling (mast vs must, then vs than)
Problem withthe Test "notNullArgs" : the arg is a String and not a String Array.
The provided tests should include (at least) one with real names rather than simply verifying that the returned array is not null.
Description is difficult to understand. Especially the expected return value. Also the provided tests are misleading, as they suggest the content of the returned array doesn't matter.
The tests for this kata do not check that the array returned actually contains the correct strings.
Might not be able to handle certain test cases
The instruction says: "We give you an Array of friend's list." In fact there are test cases which have a friend, but the input is a String, and not a String[]. This is contradictory and confusing given that one test case is an empty String[] (which reflects the stated requirement).
Error message are not so spesific
The last test is broken.
This kata is confusing because the instructions contain the following example:
input: {"Bilal"} output: {"Hello,Bilal"}
There is an implied space between "Hello," and "Bilal" that doesn't seem to show in the instructions
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This is my way of thinking. I think this makes the method more flexible. Don't you think?
This comment has been hidden.
Yes! it's like this : "Hello, Flen!"
You should better specify that there is a space in between the word Hello and the comma "Hello,[SPACE]".
I think it's so clear! Do you know typo rules! there is always a space after a comma or a point!
I liked the assignment, but please clear up the formatting of the description. The method declaration is not needed in there. You make two headlines: input and output to make it very clear what is part of the assignment.
Thank you for your feedback ^^ I'll try to make it better
You should explicitely say what the method should output on edge cases :
The explanation is very bad formatted, and the problem is very vague.
What do you suggest!!
test messages spelling "Mast"
The tests expect the function to return null when passed zero args, but this is not mentioned in the description.
There are a handful of spelling/grammar mistakes in the description and tests (e.g. "right" instead of "write", "mast" instead of "must", etc.)
More than a handful!
Minor typos in description, like "right a solution" should read "write a solution".
Thanks for your feedback. I fixed it
Description grammar:
We give you an Array of friends names. Write a method called greetingForAllFriends, with this signature:
public String[] greetingForAllFriends(String... friends);
This method takes an array of names and returns a greeting messages Array.
Message sample: for the friend "Bilal" we get "Hello, Bilal!"
Kata test case messages (real and example): should be "Must" instead of "Mast". "Mast return something else then null for none empty nor null args" should be "Must return something other than null for non-empty or null args"
Grammer issue solved, thank you for your feed back :)
0 autocomplete, no copypaste function.
well, you instruction show in web is "Hello Brils!" but there is en [Space] after Hello so when I submit my solutions without the [Space]. the output only show Expacted:But was:
The initial solution misspells "Friends" as "Freinds" in two places. One of the tests also misspells the word "must" as "mast".
I fix it, Thanks
greetings
is not a defined variable in the given test cases. This causes the test cases to always crash. I worked around this by addingGreetingsMyFreinds greetings = new GreetingsMyFreinds();
to every test case. The class name ofGreetingsMyFreinds
is spelled wrong and should beGreetingsMyFriends
. In your description, "this" is spelled as "thit." The error messages upon failing a submission are not very helpful as they readarrays first differed at element [0]; expected: but was:
when I was missing an "!" on the end of my strings. Just a few things that could be cleaned up. Otherwise I didn't see any issues.thank you for your feedback. I fixed those issues, The Kata will work better. Please try it again