Retired

Greeting My Friends (retired)

415 of 1,582bilalDjago
Description
Loading description...
Fundamentals
Arrays
Data Types
Lists
Data Structures
  • Please sign in or sign up to leave a comment.
  • Trand25 Avatar

    In Java, the singleArg test is not working because it is testing a String instead of testing an array of String...

  • mtpereira Avatar

    Tests do not execute properly because of some syntax error on their implementation.

  • russh Avatar

    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.

  • dinglemouse Avatar

    the singleArg test case is broken

  • Fabianopb Avatar

    Hey, 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?

  • CherNika Avatar

    correct tests in java please

  • riaz Avatar

    Testcase for singleArg ist not possible for Java due to return-type.

  • paul-e-allen Avatar

    For Ruby, the "expect" test in the provided Tests has syntax errors.

  • sinner27 Avatar

    function greetingForAllFriends(friends){ if(friends[index]!==null && friends!==null){ return("Hello, "+""+friends+"!")// ... } else {return null}}

    say's index is not defined in the function???

  • user8407254 Avatar

    error in java test case

  • DAslanT Avatar

    Third test case on Ruby seems to have an issue

  • Windstalker Avatar

    Tests should contain next check: if array isn't containing valid strings greeting function should return null

  • binarymason Avatar

    syntax error in test cases

  • Gaqumo Avatar

    Cannot pass the single item test. Give "Ljava.lang.String;@" error. It seems a string is expected (but the method must return a String[].

  • hetag Avatar

    Seems to be incorrect, test cases fail.

  • maur1th Avatar

    Typos in the text

  • marios25 Avatar

    Can't finish it, I do the last test right but it doesn't pass

  • do0fusz Avatar

    test case fails

  • mattpark Avatar

    Test cases fail, even though code is correct and final submission is successful

  • p4sh4 Avatar

    Third test case is broken

  • Inglorion-G Avatar

    Minor spelling error in the instructions.

  • aring Avatar

    One of the test cases expecting String, instead of array.

  • Zac Avatar

    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.

  • dewolf_luke Avatar

    Single argument provided test did not pass - passed when submitted with no problems.

  • nextlevelshit Avatar

    Typo: "random tests" instead of "randm tests"

  • jgray1206 Avatar

    Test case has string instead of string array.

  • nick.strohl Avatar

    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")

  • LinaeAzn Avatar

    Tests case raising an error on valid code

  • saj72 Avatar

    The test program has strange errors

  • Frederikbh Avatar

    SingleArg testcase in Java is wrong

  • Streetmentioner Avatar

    Ruby: "is not nil" test case is invalid syntax.

  • wardymate Avatar

    example tests not set up properly

  • tormak Avatar

    I clicked Run test and test failed despite the fact i got good solution. Accidentaly pressed "CTRL + S" and the test went through.

  • is151014 Avatar

    test case with 1 arg not working: he is expecting a string instead of an array

  • cesarloachamin Avatar

    It has an error in the unit test Single Arg expect an String when the function returns an array of strings

  • Shanetou Avatar

    None of the test cases pass with correct solutions (even with the top solution from the solutions page pasted in and run).

  • user2901357 Avatar

    Test method singleArg() is wrong in Java

  • hilary Avatar

    ruby example test syntax is broken

  • Joz Avatar

    one of test cases is incorrect, but on submit is fine..

  • akatriel Avatar

    Ruby testcases have syntax errors!

  • demonsoul Avatar

    Incorrect test case for single item array in Java; expected result is a String, but method returns String[].

  • haferjir Avatar

    The ruby version has some issues from what I guess is a poor translation of a python kata:

    • Several mentions of None should be translated to nil.
    • One test doesn't even work. it reads: x is not nil which is not proper ruby. Should be changed to x != nil or better !x.nil?
  • ADERG Avatar

    the test case checking the output containing the greeting was not formatted correctly

  • shido Avatar

    There's an error on one of the Test Case

  • tuwukee Avatar

    tests didn't work :(

  • JosephLenton Avatar

    "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.

  • edo_boy Avatar

    The third case have and issue.

  • okristian1 Avatar

    This comment has been hidden.

  • george-zip Avatar

    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.

  • pgoy Avatar

    There are a few grammatical issues in the description:

    1. "We give you an Array of friend's list." (should say "We give you an array of friends.")

    2. 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.")

    3. If the argument is a valide array of strings... (should say "If the argument is a valid array of strings...")

  • RenatKaitmazov Avatar

    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.

  • A Honey Bustard Avatar

    The last test case doesnt have the right syntax in Java

  • Kyyrbes Avatar

    This comment has been hidden.

  • TheBMachine Avatar

    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.

  • seasidetesting Avatar

    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.

  • rj1094 Avatar

    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.

  • Kclaeys Avatar

    Spelling issues in tests. "Mast" -> "Must" Unclear instructions for null / 0 size input.

  • Whalen Avatar

    Instructions unclear regarding behavior if returning "None".

  • rubybq Avatar

    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.

  • kyb3r Avatar

    Third test has a syntax error.

  • andreaseberhoefer Avatar

    The test singleArg is incorrect, instead of:

    assertEquals(greetings.greetingForAllFriends("Bilal"), "Hello, Bilal!");

    it should be:

    assertArrayEquals(greetings.greetingForAllFriends("Bilal"), new String[]{"Hello, Bilal!"});

  • siwers17 Avatar

    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.

  • mallowigi Avatar

    Ruby tests have a syntax error

  • jake9066 Avatar

    Some editing/proofreading for the description would be helpful, some of the language is confusing though it is informationally accurate.

  • cuyaken Avatar

    test code does not test for correct return type.

  • temo Avatar

    The test case is not correct

  • Zezalor Avatar

    I'm very new at this

  • drcomaneci Avatar

    Starting tests do not compile

  • picodealion Avatar

    This comment has been hidden.

  • bluej15 Avatar

    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.

  • Namdev Avatar

    Test cases in Ruby are wrong.

  • radogost Avatar

    This comment has been hidden.

  • YellowStar22 Avatar

    The test is not good. We have to edit the test function. But the issue is easy to find out

  • hdrdavies Avatar

    This comment has been hidden.

  • user4915829 Avatar

    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; }

  • NaMe613 Avatar

    One of the Ruby example test cases is broken

  • maxxx Avatar

    Test with oneArg was failed every time i run it from button "run tests". But from "submit" button everything works fine

  • radiocontrolled Avatar

    This comment has been hidden.

  • AliF Avatar

    some slightly unclear grammar in the instructions. Nothing too major, but have a read over it and see if you can clarify some parts.

  • dojobo Avatar

    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.

  • prettycoder Avatar

    too many random tests that all test the same thing the example 'expect' test does not work

  • TobyMarch Avatar

    Assertion for singleArg is expecting a String rather than String[], so test wil always fail unless modified

  • GiacomoSorbi Avatar

    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 :)

  • Unnamed Avatar

    CoffeeScript translation published.

  • electr0Nik Avatar

    Test-Case is wrong. Change description so that the user know, that he maybe has to change the test-case or fix test-case.

  • vad Avatar

    singeArg test failed, although final submit succeeded

  • vladkha Avatar

    Work more on test cases. SingleArg test is wrong.

  • akaritakai Avatar

    Problem

    As the kata is currently, it has the following sample unit test:

    @Test
    public void singleArg() {
        assertEquals(greetings.greetingForAllFriends("Bilal"), "Hello, Bilal!");
    }
    

    As the method signature is only defined for String[] and not String, the comparison will always fail.

    Suggested Fix

    @Test
    public void singleArg() {
        assertEquals(greetings.greetingForAllFriends("Bilal"), new String[] { "Hello, Bilal!" });
    }
    
  • forcery Avatar

    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.

  • ByteCommander Avatar

    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.

  • Gabain1993 Avatar

    SingleArg test test for string when return is string array.

  • Dertasz Avatar

    The java test case "single argument" is wrong. I guess it should be an array of string and it is just a string.

  • ZozoFouchtra Avatar

    JS translation kumited.

    (Description modified)

  • ChristianECooper Avatar

    Hi, I've added a Python translation, if you want to approve it, instructions for the approval process are here.

  • kajstrom Avatar

    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.

  • rigatron Avatar

    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).

  • bcreusot Avatar

    There is no test with values in the test-case part

  • simonharrer Avatar

    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.

  • WWW21 Avatar
    • Minor grammatical errors: "return" should be "returns", "valide" should be "valid"
    • Somewhat confusing wording on what the goal is

    -- 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".

  • Zazen Avatar

    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.

  • Guru Charis Avatar

    some test cases when i try to sumbit are faulty!

  • ripcord Avatar

    There're grammatical errors: "Must" is spelled is "Mast".

  • jhoffner Avatar

    I updated the formatting of the description to use markdown.

  • Drassill Avatar

    The description should give a little bit more information

  • mlabrum Avatar
    • 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.
    • When a test fails, the error message is vague at best. The test cases need to be updated to provide informative error messages.
  • mlabrum Avatar

    How am I failing the testRealValues(GreetingsTest) test? The error message is arrays first differed at element [0]; expected: but was:, and by printing the input and output, I've got the following:

    • Input: [Bilal, Amir, Rachid, Said, Yamin, Rahim, Sofiane]
    • Output (each element):
      • Hello, Bilal
      • Hello, Amir
      • Hello, Rachid
      • Hello, Said
      • Hello, Yamin
      • Hello, Rahim
      • Hello, Sofiane
  • pinieb Avatar

    The strings in the provided test cases need some cleaning up for grammar and spelling (mast vs must, then vs than)

  • GaspardP Avatar

    Problem withthe Test "notNullArgs" : the arg is a String and not a String Array.

  • ianprime0509 Avatar

    The provided tests should include (at least) one with real names rather than simply verifying that the returned array is not null.

  • sweetverbs Avatar

    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.

  • warrenma Avatar

    The tests for this kata do not check that the array returned actually contains the correct strings.

  • pallavrustogi Avatar

    Might not be able to handle certain test cases

  • marc_alain Avatar

    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).

  • hansrusten Avatar

    Error message are not so spesific

  • jliber Avatar

    The last test is broken.

  • cjmcgraw Avatar

    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

  • csteez Avatar

    This comment has been hidden.

  • antonious7 Avatar

    This comment has been hidden.

  • knotman90 Avatar

    You should better specify that there is a space in between the word Hello and the comma "Hello,[SPACE]".

  • Aganom Avatar

    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.

  • Hybris95 Avatar

    You should explicitely say what the method should output on edge cases :

    1. no parameters
    2. a null parameter within all the parameters
    3. an empty parameter within all the parameters
  • Bonsanto Avatar

    The explanation is very bad formatted, and the problem is very vague.

  • kady Avatar

    test messages spelling "Mast"

  • hawk Avatar

    The tests expect the function to return null when passed zero args, but this is not mentioned in the description.

  • epoch Avatar

    There are a handful of spelling/grammar mistakes in the description and tests (e.g. "right" instead of "write", "mast" instead of "must", etc.)

  • timc91 Avatar

    Minor typos in description, like "right a solution" should read "write a solution".

  • Azuaron Avatar

    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"

  • mytzusky Avatar

    0 autocomplete, no copypaste function.

  • iron826 Avatar

    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:

  • laoris Avatar

    The initial solution misspells "Friends" as "Freinds" in two places. One of the tests also misspells the word "must" as "mast".

  • Aut Avatar

    greetings is not a defined variable in the given test cases. This causes the test cases to always crash. I worked around this by adding GreetingsMyFreinds greetings = new GreetingsMyFreinds(); to every test case. The class name of GreetingsMyFreinds is spelled wrong and should be GreetingsMyFriends. In your description, "this" is spelled as "thit." The error messages upon failing a submission are not very helpful as they read arrays 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.