Ad
  • Default User Avatar

    Why do we need so many (any) random test cases - here?
    There are only 4 possible (valid) input states...
    Are we testing for maliciously wilful coders? Is this best practice?

    One problem with this approach (in general) is that the tester has to already have the answer (working code)...
    It's good as a teaching mechanism I guess, but not always practical as a test strategy for real world code - or am I missing something?
    I suppose, if you were updating code - say optimising an algorithm - you could use your old code and random tests to sanity check/validate your new code.

  • Default User Avatar

    Apologies, javascript.

  • Default User Avatar

    Would suggest putting a Math.abs() around difference in test cases...
    i.e. Math.abs(got - expected) < delta

  • Default User Avatar

    Also think closures are a more difficult concept.
    IMO.. this should prob be a 6kyu problem.

  • Default User Avatar

    Is this really using the concept of closures though?