Ad
  • Custom User Avatar

    My main concern is with overloading the console output. It goes against the submission test guidelines.

    Tests should not print excessively to standard output. Console output is limited to 1.5 MB and when the limit is reached, the test suite is aborted by the runner and marked as failed. Users sometimes debug their solutions by printing to stdout, and when the test suite itself uses up a significant fraction of the buffer, users may not have enough left for debugging. This especially applies to kata which output HTML to create some visualizations: such HTML uses up a lot of the buffer space allowed for stdout. Ideally, the test suite should give detailed output only when a test fails.

    A fair compromise would be to revert the behavior of the submission tests while still printing the visualizations for the sample tests.

  • Custom User Avatar

    Thanks!

    I modified it slightly to display the tree and nuts on the ground regardless of test pass/fail. This make it same as all other translations.

    Please take a look at my hacked changes (I'm not a Haskell programmer). If it seems OK, I will Approve.

  • Custom User Avatar
  • Custom User Avatar

    I see it now, will try in the future.
    Thanks a lot :)

  • Custom User Avatar

    You read the test results wrong. Which I do not blame you, because it is a poor test output with not very clear feedback on failure. But the issue is not "tests expect wrong answers", but "tests use poor assertion messages".

  • Custom User Avatar
  • Custom User Avatar

    The issue not with random tests, but with the fixed test called "one".

    There is more than one test in "one". The first one is (15, 15), which your hardcoded solution passes. Then your solution fails for the second test in that block which tests (18, 21) when it returned undefined. There is no message when your code passes a single test like that.

  • Custom User Avatar
  • Custom User Avatar

    It returns undefined even if ownedCatAndDog(15,15) is called.

    I do not see this happening. I can see that your current, shortened solution correctly returns [1, 1] for inputs (15, 15).

  • Custom User Avatar

    The issue not with random tests, but with the fixed test called "one".
    Ok, will try discord sometime in the future, thanks

  • Custom User Avatar

    Once again, without seeing your exact code it is impossible to understand your problem, and fix the kata (if there is anything to fix). Saying what you did will not help, because the important part is to know how you did it. Hardcoding will be not really helpful, because with random tests it is difficult to do and requires hardcoding a lot of inputs, which I am not sure you did. There has to be some misunderstanding somewhere: either you misunderstood the task, or you misunderstood the test output, or I misunderstood your problem, because from all I see, your solution is just buggy and does not account for all cases.

    Maybe it will be easier if you come to the #help-solve channel of Codewars Discord so we could discuss the matter there.

  • Custom User Avatar

    It returns undefined even if ownedCatAndDog(15,15) is called. That is the issue.
    I specifically updated it to see the error.

  • Custom User Avatar

    Your current code errors because it returns nothing unless ownedCatAndDog(15,15) is called. Meaning your code always returns undefined in all other cases. Once your code fails the first test in a block, no other tests in the block are run. It is very unlikely that the first random test will test for (15, 15), so your code will always return undefined unless you happen to get very lucky. There is nothing wrong with the tests, I have just solved the kata in JS. There is a deprecation warning because the test framework needs to be updated, but that has no bearing on the success of your code.

  • Custom User Avatar

    I tried bunch of stuff, including straight up if else statements (latest one, yes).
    You can simply try catching (15, 15) without any other particular logic/variables/etc (that's what i call hardcoding) and it will return an error.

  • Custom User Avatar

    I am not sure what you mean by "hardcoded solutions".
    It is difficult to tell what is wrong with your code without knowing your code.

    I can see one of your solutions, but I do not know if it's the most recent one. The solution I can see returns wrong answer for, for example, ownedCatAndDog(16,16) - the expected answer is [1,1], but your solution returns [0,0].

  • Loading more items...