Ad
  • Default User Avatar

    Study problems similar to this often simply return true/false. The Kata details don't really explain that the index of the found value should be returned.. not that it's hard to figure out, but for javascript (no explicit return types) it was a stumbling point for me to discover that the expanded test cases were looking for anything other than '1' to indicate success.

  • Default User Avatar

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

  • Default User Avatar

    I am not sure what I've done here with 'fork' I thought I was forking my solution, not the Kata..

  • Default User Avatar

    Ooohhh.. it was showing me the diff between the answers. I've seen that before. OK.
    Thank you!

    I think I would have figured it out if the failure told me it was using 625 as an input.
    The asserts could be written to include a message regarding the input:

    int n = 625;
    assertEquals("Unexpected result for input: " + n, "2 5 8 34 624", d.decompose(n));

  • Default User Avatar

    I am having trouble understanding some of the hidden tests after submitting my solution in Java.
    The results don't make any sense to me.

    For example:

    test3(DecomposeTest)
    expected:<[2 5 8 34] 624> but was:<[4 12 33] 624>
    

    The input is not stated, and confusion sets in when trying to understand the failure.
    Doing the math:

    2*2 + 5*5 + 8*8 + 34*34 = 1249
    4*4 + 12*12 + 33*33 = 1249
    

    Good, both are solutions for the same input.. It looks like the expected result is correct because it holds the
    largest value.. but.. what's the input?

    sqrt(1249) = 35.3411940941
    

    The details of the Kata explain that the input is a "positive integral number".. This is an invalid input for the
    Kata, and more than that, I don't understand how a floating point number can be submitted as a long value in Java,
    anyway.

    So, I still don't know what was the input for this test failure, and I still haven't figured out the significance of
    the 624 value in the output of the failed test.

    The following tests present the same confusion:

    test4(DecomposeTest)
    expected:<[2 3 5 119] 7099> but was:<[1 5 22 117] 7099>
    test6(DecomposeTest)
    expected:<[2 8 32 1571] 1234566> but was:<[1 2 10 102 1568] 1234566>
    

    Please help.. What am I missing? or are theses tests bogus?