Ad
  • Default User Avatar

    I have a problem with randomTests, always one of the tests fails in the same way after 6-10 tests.

    Env: PHP 8.0
    Json of array elements $piecesPositionList

    ["E_Yellow","A_Red","C_Yellow","C_Red","G_Yellow","B_Red","D_Yellow","B_Red","A_Yellow","E_Red","A_Yellow","G_Red","G_Yellow","D_Red"]"
    

    My result: Win:Yellow

    Tests result:

    Failed asserting that two strings are identical.
    Expected: 'Red'
    Actual  : 'Yellow'
    

    The problems I see:

    1. the tests are written in such a way that once in a while under the right assumptions of the algorithm this problem occurs. This is impossible to debug
    2. my algorithm is too inefficient and causes phpunit error (this is unlikely)

    Any possible suggestion of a solution is welcome.

  • Default User Avatar
  • Default User Avatar

    I have a problem with this Kata in PHP 7.0.

    I failed test,but I think I should have passed.

    I got an error:

    Failed asserting that two strings are equal.
    Expected: 'wlwsasphmxxowiaxujylentrklctozmymu'
    Actual  : 'owiaxujylentrklctozmymuwlwsasphmxx'
    

    But if I dump $strarr and $k

    $strarr =
    array(3) {
      [0]=>
      string(11) "wlwsasphmxx"
      [1]=>
      string(23) "owiaxujylentrklctozmymu"
      [2]=>
      string(10) "wpgozvxxiu"
    }
    
    $k = int(2)
    

    As you can see, the first value shoud be owiaxujylentrklctozmymu and second wlwsasphmxx, but test makes us provide wlwsasphmxx first and owiaxujylentrklctozmymu second.

    Test name: ConsecutiveTestCases -> testBasics