Ad
  • Default User Avatar

    thnx for the feedback, Chrono!
    i finally figured out what it was that...
    because of your "js test" suggestion.

  • Custom User Avatar

    Nevermind, I read the code wrong and thought the user could mutate it before expected value was calculated.
    Yes it is a bad practice, but sometimes that makes the tests vulnerable to cheating solutions (not in this case).

  • Default User Avatar

    Why is it a problem? I thought it is bad practice to mutate the input.
    I will modify by calculating the reference solution before testing.

  • Custom User Avatar

    Print the input value too, but afaik the kata tests are ok. The first one is the value your function returned and the second one the value it should have returned.

  • Default User Avatar
  • Default User Avatar

    Done, thanks.

  • Custom User Avatar

    Change the js testing to show the arrays on error message (currently it only does that for small arrays only):

    const chai = require("chai");
    const assert = chai.assert;
    chai.config.truncateThreshold = 0;
    
    ...
    
    function dotest(ls, expect) {
        let actual = partsSums(ls);
        assert.deepEqual(actual, expect);
    }
    
  • Default User Avatar

    Hello! Thanks for "perfomance" kata!

    Random tests
    expected [ Array(17) ] to deeply equal [ Array(17) ]

    for this test the "if" statment returns "ls" as is...
    but its don't match, what a heck

  • Default User Avatar
  • Custom User Avatar

    Your code is printing the result instead of returning it.

  • Default User Avatar

    sumOfDifferences([1, 2, 10] Log 9
    Expected: 9, instead got: undefined
    sumOfDifferences([-3, -2, -1]) Log 2
    Expected: 2, instead got: undefined