Ad
  • Custom User Avatar

    There's also no reason to print on each test iteration. Feedback is really only necessary when a test fails.

    Please also expand the assertion messages for the sample_tests, remove the print line and add the input to the assertion message.

  • Custom User Avatar

    Looks good, except for this line

    let input = rand.gen_range(1..20000);
    

    It seems overkill, and is way outside the intention of the Kata. e.g. No pet, (and no pet owner) is going to live for 20000 human yrs. Make that a much smaller realistic number number and then I will approve it.

  • Custom User Avatar

    My apologies. I totally forgot I attempted to do this two years ago. I hope the revision meets the expectations.

  • Custom User Avatar
    • Input type should be u32, since we explicitly state that there are no negative values.
      • Your tests for some reason generate negative values for the input. Don't.
    • There is no reason to return a Vec, since there are always 3 values. Either [u32;3] or (u32,u32,u32).
    • All assertions need proper assertion messages; nobody knows what left and right mean.
      • Always mention the input
      • Clarify what "left" and "right" refer to, i.e. which is the user's value, which is the expected value.
    • Only use the user function in the test module, don't import everything (*). We don't know what other items the user is going to define, and we don't want them polluting our namespace.

    I will reject this, feel free to fork it and update with fixes.