Ad
  • Custom User Avatar

    The problem is that with Random.Shared.Next(1, int.MaxValue), your tests have a very high chance to be mostly meaningless: they will generate many numbers which are very easy to solve, and very few interesting numbers, which are more difficult to solve. For example, out of 30 numbers you generated, approx. 15 of them will be even numbers, which are trivial to solve.

    Your tests are not great, because they do not generate interesting inputs. Your solution is apparently also not great, because it's not able to solve the interesting inputs :)

  • Custom User Avatar

    Well, I have some bad news: there seems to be ~1000 tests when you hit "Attempt".

    The problem is that your solution is doing more work than it has to. Your max condition can be improved significantly :P

  • Default User Avatar

    C#. Why does "Attempt" time out? I extended the test script to include 30 of these:

    yield return new TestCaseData(Random.Shared.Next(1, int.MaxValue)).Returns(true);

    and multiple test runs completed in, and I quote:

    Time: 4756ms Passed: 6Failed: 30Exit Code: 1

    Time: 4578ms Passed: 6Failed: 30Exit Code: 1

    Time: 6446ms Passed: 8Failed: 28Exit Code: 1

    Time: 9301ms Passed: 9Failed: 27Exit Code: 1

    Time: 8725ms Passed: 9Failed: 27Exit Code: 1

    Time: 5229ms Passed: 7Failed: 29Exit Code: 1

    yet "Attempt" constantly times out at 12s. It seems like "Attempt" runs considerablly slower than merely testing.

    I will skip this kata :(