Ad
  • Default User Avatar

    Check the scope of all your variables. Behaviour like this usually indicates some value is persisting between method calls.

  • Default User Avatar

    Of course! That makes sense and I should have saw that. The random tests would use the same input to validate. Static tests would know what output to expect.

    Thanks.

  • Default User Avatar

    I'm having issues with the large array tests in Powershell. The test case and my code always arrive at the same final sum (value at index 0 in the result) but my results differ from the expected results by a small amount in every other value. I also end up with a shorter array by 2.

    As an example, the first 3 expected totals from a random test are 0, 5, 24 and my results are 0, 4, 14 yet we both end up with a final total of 8398.

    I output the array passed in and manually worked out the first few results. The results calculated manually match what my algorithm is calculating but do not match the expected results. Example from a random test:

    First few values: 16 16 18 14
    Expected results: 0 12 33 38
    My calculated results: 0 16 32 50

    I don't see how the expected results are getting calculated.

  • Default User Avatar

    I just completed the PowerShell version and realized my solution did not make all characters uppercase. Simple omission on my part that should have been caught by the tests. I realize PowerShell is still in beta. This is probobly just the wrong comparison operator in the test code (easy to get mixed up since it's case insensitive by default).