Ad
  • Custom User Avatar

    Approved

  • Custom User Avatar

    python new test framework is required. updated in this fork

  • Custom User Avatar
  • Custom User Avatar

    Done. Thanks!

  • Custom User Avatar

    Should be fixed by now. Thanks!

  • Custom User Avatar

    Adapted the description to include "non-negative" values and fixed test cases. Thanks!

  • Default User Avatar

    input is vulnerable to mutation, in the random tests

  • Custom User Avatar

    Your tests never include duplicate values. Better test that as well.

  • Default User Avatar

    yes, expected and actual are effectively swapped in the random tests. And 0 can show up from time to time in some of those.

  • Default User Avatar

    that would depend on who you are talking too, unfortunately. That's why it should be told plainly in the description.

  • Custom User Avatar

    Zero isn't positive or negative and shouldn't be "considered" as such. The judge solution uses >= 0, so the kata should say "non-negative" instead of "positive".

  • Default User Avatar

    Ah, I forgot one important edge case: what about 0? => you have to tell if you considere it positive or negative (positive, looking at your solution) and put some tests with it. Note that your random tests may not generate any zero, otherwise, ZED's solution would never have passed.

  • Custom User Avatar

    Got this:

    Random test for even array length: [-669, 0, -1088, 89, -2807, 1135, -2979, 2269, -4103, 2337, -5255, 2539, -6052, 3146, -7453, 3346, -8122, 5012, -8164, 5113, -9240, 5434, 6557, 7928, 8017, 8407, 9034, 9091, 9528, 9568]
    should equal [-669, 89, -1088, 1135, -2807, 2269, -2979, 2337, -4103, 2539, -5255, 3146, -6052, 3346, -7453, 5012, -8122, 5113, -8164, 5434, -9240, 6557, 7928, 8017, 8407, 9034, 9091, 9528, 9568]
    

    I'm sure you confused mine and yours. My solution definitely doesn't include zeros. Because I do what the problem asks, output only negative and positive values.

  • Custom User Avatar

    Thanks, I've added fixed tests that account for all three of these cases as well as random tests for "only negative" and "only positive" arrays.

  • Default User Avatar

    Hi,

    Interesting one.
    You should add some edge cases, though:

    • only negative values
    • only positive values
    • same as your last fixed tests, but with extra negative values