Ad
  • Custom User Avatar

    Sorry, I figured it out, but I was confused by empty arrays with nil and zero length

  • Custom User Avatar
    should handle random cases
    Log
    array1: [-35 -93 -53 -89 -35 16 88 96 10 74 76 64 72 36 -95 40 -89 -33]
    array2: [100 256 1089 1225 1225 1296 1600 2809 4096 5184 5476 5776 7744 7921 7921 8649 9025 9216]
    array1 sorted: [-95 -93 -89 -89 -53 -35 -35 -33 10 16 36 40 64 72 74 76 88 96]
    array2 sorted: [100 256 1089 1225 1225 1296 1600 2809 4096 5184 5476 5776 7744 7921 7921 8649 9025 9216]
    false
    Expected
        <bool>: false
    to equal
        <bool>: true
    

    @natan
    what exactly expected "false" in this case and what same it got "true" ??
    I return "false", as expected, but test say I return "true"

  • Custom User Avatar

    Yes, I understand - but why it no passed in attempt ??
    see log report - I print out all arrays and do not understand why expected false at first case (only one "true" and it realy true) and in second case, where no one "true", but it say equal "true"

    ps. it is in golang

  • Custom User Avatar

    GO:
    tests passed, attempt - no

    why??

    Click to expand
    should handle basic cases
    Log
    array1: [121 144 19 161 19 144 19 11]
    array2: [121 14641 20736 361 25921 361 20736 361]
    array1 sorted: [11 19 19 19 121 144 144 161]
    array2 sorted: [121 361 361 361 14641 20736 20736 25921]
    true
    array1: [121 144 19 161 19 144 19 11]
    array2: [231 14641 20736 361 25921 361 20736 361]
    array1 sorted: [11 19 19 19 121 144 144 161]
    array2 sorted: [231 361 361 361 14641 20736 20736 25921]
    false
    array1: [121 144 19 161 19 144 19 11]
    array2: [121 14641 20736 36100 25921 361 20736 361]
    array1 sorted: [11 19 19 19 121 144 144 161]
    array2 sorted: [121 361 361 14641 20736 20736 25921 36100]
    false
    array1: []
    array2: []
    false
    Expected
        <bool>: false
    to equal
        <bool>: true
    
    Click to expand
    array1: [80 -13 -57 -17 -47 66 30 58 -17 -25 34 80 10 -15 -43 -21]
    array2: [-34 100 169 225 289 289 441 625 900 1849 2209 3249 3364 4356 6400 6400]
    array1 sorted: [-57 -47 -43 -25 -21 -17 -17 -15 -13 10 30 34 58 66 80 80]
    array2 sorted: [-34 100 169 225 289 289 441 625 900 1849 2209 3249 3364 4356 6400 6400]
    false
    array1: [-97 44 -79 74 78 -55 -63 22 -27 -43 96 62 36 -91 -27 -61]
    array2: [-44 -22 729 729 1296 1849 3025 3721 3844 3969 5476 6084 6241 8281 9216 9409]
    array1 sorted: [-97 -91 -79 -63 -61 -55 -43 -27 -27 22 36 44 62 74 78 96]
    array2 sorted: [-44 -22 729 729 1296 1849 3025 3721 3844 3969 5476 6084 6241 8281 9216 9409]
    false
    array1: [-23 88 -19 42 -59 22 -93 62 20 62]
    array2: [-88 -20 93 361 484 529 1764 3481 3844 3844]
    array1 sorted: [-93 -59 -23 -19 20 22 42 62 62 88]
    array2 sorted: [-88 -20 93 361 484 529 1764 3481 3844 3844]
    false
    array1: [-41 24 34 80 16 48 60 76 66 -11 -43 18 -77 10 80 82 -3 66]
    array2: [9 11 100 256 324 576 1156 1681 1849 2304 3600 4356 4356 5776 5929 6400 6400 6724]
    array1 sorted: [-77 -43 -41 -11 -3 10 16 18 24 34 48 60 66 66 76 80 80 82]
    array2 sorted: [9 11 100 256 324 576 1156 1681 1849 2304 3600 4356 4356 5776 5929 6400 6400 6724]
    false
    array1: [4 -67 48 88 -57 32 -99 -37 -65 -39 94 -29 46 -17 82 -83]
    array2: [16 39 57 289 841 1024 1369 2116 2304 4225 4489 6724 6889 7744 8836 9801]
    array1 sorted: [-99 -83 -67 -65 -57 -39 -37 -29 -17 4 32 46 48 82 88 94]
    array2 sorted: [16 39 57 289 841 1024 1369 2116 2304 4225 4489 6724 6889 7744 8836 9801]
    false
    array1: [82 -29 -75 72 58 8 74 84 40 -15 44 34 38 94 28]
    array2: [-84 29 64 225 784 1156 1444 1600 1936 3364 5184 5476 5625 6724 8836]
    array1 sorted: [-75 -29 -15 8 28 34 38 40 44 58 72 74 82 84 94]
    array2 sorted: [-84 29 64 225 784 1156 1444 1600 1936 3364 5184 5476 5625 6724 8836]
    false
    array1: [-77 -27 -95 28 -87 -61 -71 42 6 -51 14 34]
    array2: [-42 36 61 196 729 784 1156 2601 5041 5929 7569 9025]
    array1 sorted: [-95 -87 -77 -71 -61 -51 -27 6 14 28 34 42]
    array2 sorted: [-42 36 61 196 729 784 1156 2601 5041 5929 7569 9025]
    false
    array1: [-29 -19 -25 -53 -99 -35 2 -17 -31 14 52 16 -17 18 42 -65]
    array2: [-42 4 65 196 256 289 289 324 361 625 841 961 1225 2704 2809 9801]
    array1 sorted: [-99 -65 -53 -35 -31 -29 -25 -19 -17 -17 2 14 16 18 42 52]
    array2 sorted: [-42 4 65 196 256 289 289 324 361 625 841 961 1225 2704 2809 9801]
    false
    array1: [12 -31 -77 -37 80 88 -95 -5 -59 -43 66]
    array2: [-88 25 144 961 1369 1849 3481 4356 5929 6400 9025]
    array1 sorted: [-95 -77 -59 -43 -37 -31 -5 12 66 80 88]
    array2 sorted: [-88 25 144 961 1369 1849 3481 4356 5929 6400 9025]
    false
    array1: [52 36 8 -21 -9 -35 -7 -3 78 26 -51 -61]
    array2: [-78 -52 -36 9 21 49 61 64 81 676 1225 2601]
    array1 sorted: [-61 -51 -35 -21 -9 -7 -3 8 26 36 52 78]
    array2 sorted: [-78 -52 -36 9 21 49 61 64 81 676 1225 2601]
    false
    array1: [-39 -23 -39 -87 -49 -47 -91 2 -7 46 64]
    array2: [4 49 529 1521 1521 2116 2209 2401 4096 7569 8281]
    array1 sorted: [-91 -87 -49 -47 -39 -39 -23 -7 2 46 64]
    array2 sorted: [4 49 529 1521 1521 2116 2209 2401 4096 7569 8281]
    false
    Expected
        <bool>: false
    to equal
        <bool>: true
    
  • Custom User Avatar

    time well spent. thanks:)