Ad
  • Default User Avatar

    look for the difference in these two lines:

    [[M: 37 B: 5 C: 4][][M: 100 B: 14 C: 11]...
    [[M: 37 B: 5 C: 4][, ][M: 100 B: 14 C: 11]...

  • Default User Avatar

    thx a lot, now it's much clear

  • Custom User Avatar

    No problem for me. I added in "Your example test cases":

    assertEquals("[[M: 9991 B: 1427 C: 1110]]", Carboat.howmuch(9990, 10000));

    and the tests passed. But if I put

    assertEquals("[[M: 9990 B: 1427 C: 1110]]", Carboat.howmuch(9990, 10000));

    which is false because of 9990 instead of 9991

    I'm getting

    expected:<[[M: 999[0] B: 1427 C: 1110]]> but was:<[[M: 999[1] B: 1427 C: 1110]]>
    

    the extra brackets which you found weird are there to show where the strings are different! Hope that will help you!

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    runnig my code in IDE with howmuch(9990, 10000) gives [[M: 9991 B: 1427 C: 1110]] but submitting the same code in CW gives:
    BasicTests(CarboatTest)
    ****** Basic tests ******
    expected:<[[[M: 9991 B: 1427 C: 1110]]]> but was:<[[]]>

    =(

    task for kata is cool but output format should be reconsidered since there are strange issues with those braces...

  • Default User Avatar

    thanks, I'll check it..but then probably Instructions should be updated so they are consistent with Unit test to minimize confusion?

  • Custom User Avatar

    Java tests are correctly written but for a reason I don't know the output of square brackets in CW is weird:-(

    besides Kata Instructions state: howmuch(1, 100) => [["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"]]

    Note in "Your example test cases" and "Your solution" that in Java the function returns a string which kind of mimics an array.
    In "Your example test cases" you could read:

    assertEquals("[[M: 37 B: 5 C: 4][M: 100 B: 14 C: 11]]", 
    				Carboat.howmuch(1, 100));
    

    which, as you can see is correctly written.

    Many Codewarriors passed the kata in Java without problems. I just tried myself and everything went fine.

  • Default User Avatar

    Java test says: expected:<[[M: 37[ B: 5 C: 4][M: 100 B: 14] C: 11]]>
    guys, what?? what is that format with square brace after "37"?
    besides Kata Instructions state:
    howmuch(1, 100) => [["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"]]

    Format of output is completely different - double quotes, less braces. Probably Java tests should be fixed =(

  • Default User Avatar

    that was an infinite loop due to wrong condition ;(

  • Custom User Avatar

    The general workaround is to write faster code.
    Although for this kata, I can't really imagine an answer which is too inefficient.
    Infinite loop/recursion is more likely.

    Could you post your code here? (Mark it as spoiler)

  • Default User Avatar

    .length points to just a field of array object. No calculations are even beeing performed at this point.
    The much worse is concatenating strings in a cycle. That's a very bad practice

  • Default User Avatar

    Process was terminated. It took longer than 10000ms to complete
    well ((((( what's workaround here?