Ad
  • Default User Avatar

    @dinglemouse - no problem, it was also kind of fun to figure out what is wrong there :)

    @metawort - all test cases are ok now, I tried also my original solution (where the problem appeared) and it works (all test cases passed)

  • Default User Avatar

    Well, maybe it is by purpose, to test if the solution works correctly also when the lift had already done some progress before calling the function. If yes, mark this issue as resolved.

    Anyway, I was able to update my solution to pass all the tests everytime and this was a great kata!

  • Default User Avatar

    I had luck and one of my attempt tries was successful - all tests passed, so I was able to submit my solution and check the test cases, and I think there is an issue in random test cases for Typescript:
    For the user result, function theLift is called and for the expected result, function myAnswer is called, but inside of function myAnswer function theLift is also called, that means that user implementation is used for expected results.

    I guess this is wrong and function myAnswer should call itself instead of function theLift. Am I right?

  • Default User Avatar

    COMMENT UPDATED AND CHANGED FROM QUESTION TO ISSUE
    (original comment is below, found issue described in reply)

    Coding in TypeScript - I am still getting first random test failed (all the other test are always passed, just first random test R#0 is failed) and no idea why, because sometimes it is really simple test case. Here is the example with logs:

    R#0: 18 floors, 45 people, lift holds 5
    Log
    input parameter result: [ 0, 1 ]
    queues: 
    [ [], [], [ 1 ], [] ]
    capacity: 4
    return: [0, 2, 1, 0]
    input parameter result: undefined
    queues: 
    [ [ 1 ], [], [ 1 ], [] ]
    capacity: 4
    return: [ 0, 1, 2, 1, 0 ]
    expected [ 0, 1, 2, 1, 0 ] to have the same members as [ 0, 2, 1, 0 ]
    

    It looks that there are actually 2 tests, and result from the first is the expected one ([0,2,1,0]), also second result is correct based on the input queues, but the second result is compared with expected result from first test and it is obviously failed.

    Another thing, I don't understand why there are required input parameters result and direction, as you can see in example above, in first test the input parameter result has assigned value [ 0, 1 ] and in second test it is undefined. Maybe this causes the issue, because the second result always contains this result parameter from first test at the beginning. Another example just to see it clearly:

    R#0: 6 floors, 6 people, lift holds 3
    Log
    input parameter result: [ 0, 1, 2, 3, 4 ]
    queues: 
    [ [], [], [ 4, 0, 3 ], [], [] ]
    capacity: 4
    return: [ 0, 2, 3, 4, 2, 0 ]
    input parameter result: undefined
    queues: 
    [ [ 1, 4, 4, 1 ], [ 3, 2 ], [ 3, 4, 0, 3 ], [], [] ]
    capacity: 4
    return: [ 0, 1, 2, 3, 4, 2, 0, 2, 3, 4, 0 ]
    expected [ 0, 1, 2, 3, 4, 2, 0, 2, 3, 4, 0 ] to have the same members as [ 0, 2, 3, 4, 2, 0 ]
    

    You can see that result from first test is expected result, and result from second test starts with the input parameter result from first test ([ 0, 1, 2, 3, 4 ]).

    It is really wierd that all the other complex tests are always passed, only this one fails.
    Am I missing something here or is this an issue of the test?