Ad
  • Custom User Avatar

    Hi Zoltan, nice Kata idea, but there are some problems: the tests should be 'testAssertEquals' and what the code has to return written out in full, or at least 'NO!' should be replaced by 'NO WAY!' in order for 'testAssertContains' to work with the requested return for a negative.

    I think something is wrong with your test code, also, as when I try to test I get the error 'Journey is not defined'. You should check your code to make sure you've not got Journey instead of 'myJourney' somewhere, perhaps?

  • Custom User Avatar

    The description is hard to read and misleading, e.g. you write you need to create your own map but all I need is the two dimensional array that's passed as the first argument.
    Or you write each zone will cost you £1 more to cross which I read as "it costs 2 + 3 + 4 + ... = (n + 2) * (n - 1) / 2 to travel from zone a to zone a + n" but instead it's just "n + 1".

    The solution setup has unneccessarily an array stations and a function call myJourney(stations, 5, "Dalston", "Crystal Palace");. Remove them.

    The tests use assertContains which IMHO is an invitation to cheating.
    Better be specific about what you expect, e.g. "return a string 'YES! You can make it! You will have £xxx left on your card.' (where xxx is the amount of credits left after paying for the ride) OR 'NO! Top-up £xxx or more for this journey.' (where xxx is the amount of additional credits needed for the ride)."
    Then testing becomes a lot easier.

    Also, the random tests are commented out.

    Currently this kata looks half-baked. I suggest you un-publish it and improve it in 'Draft' state or you will get a lot of negative votes.

  • Custom User Avatar

    As mentioned below, it's a duplicate.

    Also, trailing new line is not specified.

  • Custom User Avatar

    Random testing not implemented. But really, don't bother. Too simple and too probably a duplicate.