Ad
  • Custom User Avatar

    Reading is a lost art ..

    Sorry I could only upvote your comment once Cito.

  • Default User Avatar

    really nicer and more readable, yes. :)

  • Custom User Avatar
  • Default User Avatar

    It's less readable because you put the function decs on new lines, which I've never seen before and don't think anybody actually does. The code itself is still not great as using arbitrary names such as "v" and "w" don't give you any hints about what the code actually does.

    Also, best practice should definitely include how the code is presented. Code that can be passed around from colleage to colleage and be quickly understood by everyone should be something you're looking to achieve, i.e. it should be part of the best practice.

  • Default User Avatar

    Very interesting. Not sure why your random tests are passing while mine are not. If I am reading my output correctly, my code seems to be returning the correct response while the randomized tests seem to expect an incorrect response. Thanks for checking it out.

  • Default User Avatar

    I saw your link. Below a small part of what I got with trying once more:

    Random Testing mxdiflg:
    [] , [ 'aa', 'yymmmmbbll', 'iiiiqhhhhgggssw', 'xxhhiiittuu', 'bbzz', 'ssmdddyy', 'nnlll' ]
    Test Passed: Value == -1
    
    Random Testing mxdiflg:
    [ 'wwffqqqaammmmfffss', 'fffffkknn', 'ddlllqquuwwwwccaaah' ] , []
    Test Passed: Value == -1
    
    Random Testing mxdiflg:
    [ 'xoofffqq', 'gsssfftsssseeeettt', 'gggxxxxmmmmmsssppeeeeekkkhhhbbkk' ], []
    Test Passed: Value == -1
    
    Random Testing mxdiflg:
    [], [ 'ooollkkkkhhhh', 'qqqqeljjffbooobbb', 'v' ]
    Test Passed: Value == -1
    
  • Default User Avatar

    Please have a look at this screenshot: http://i.imgur.com/xUvzsUb.png

    In every test case the correct answer is -1 which is what my code is returning. However, the test cases expect a different result.

  • Custom User Avatar

    I repeat myself:

    the expected result is -1 when at least one of the arrays is empty.

    I tested the random tests too as everybody passing the kata did and I had verified that a test returns -1 in this case.
    I don't understand why you got 26.
    The "solution" in the random tests returns -1 for the example you gave in your previous post:
    [ 'ttffdddooo', 'bbbtttthhhnnnny', 'hhkkkww', 'jlllh', 'jjccccaaaazzzztttqqqwwqqqq' ] [] --> -1

  • Default User Avatar

    Thanks for replying. Does it sound like I correctly understand what this kata is asking for? If I do, then the random test cases are incorrect and should be checked. If you look at the output that I pasted in - given that the second array is empty - the correct result should be -1 however, the test is expecting it to be 26.

  • Custom User Avatar

    Sorry of not having answered sooner but I just saw your post. If it is JS, 55 CW passed the kata without problem. I tried the kata once more and the expected result is -1 when one of the arrays is empty.

  • Custom User Avatar

    De rien, monsieur :)

  • Custom User Avatar

    You are right, I cut it too short! Corrected. Thanks Giacomo!

  • Custom User Avatar

    Ruby example test case is missing the .assert_equals, it seems.

    Btw, pretty good kata and glad to see Raul is considering JS too :)

  • Default User Avatar

    I find the instructions very confusing. After experimenting with your test cases it seems like you are asking the user to find the smallest and largest string lengths in each array. If the smallest length is in the first array, subtract the largest length from the second array and return the absolute value. Otherwise take the largest length from the first array and subtract the smallest length from the second array and, again, return the absolute value.

    Is this correct?

    Edit:
    It seems some of the random tests (in Javascript) are wrong. The instructions say if either arrays are empty it should return -1. When I log the arguments provided I see several tests with empty arrays. My code returns -1 in all cases but the tests are expecting a postive numerical result.

    Example:

    [ 'ttffdddooo',
    'bbbtttthhhnnnny',
    'hhkkkww',
    'jlllh',
    'jjccccaaaazzzztttqqqwwqqqq' ] []
    It should work for random tests too - Expected: 26, instead got: -1```
    
    In the above copy/paste, the answer should be `-1` since the second array provided is empty, yet the test is expecting the answer to be `26`.
    
  • Custom User Avatar

    Mh, checked into it and found nothing in my code (which also passes the default tests), but I did some edit to be extra sure; can you try again and then possibly comment under my own comment down below (I could not get notified otherwise)?

    Thanks for your feed in the meantime :)

  • Loading more items...