Ad
  • Custom User Avatar

    Ah okay. Thanks.

  • Custom User Avatar

    I just noticed that the Beta Status for this kata still says 'Testing and feedback needed'. I thought I had taken care of the testing on this, but please do let me know if there is something else required. Thanks.

  • Custom User Avatar

    Got it. Thanks again for all your help.

  • Custom User Avatar

    Wow, thank you for taking the time to write all that. So let me make sure I get this: because arrays are passed by reference in JavaScript, modifications to the array from within the function will of course also change the array from outside of the function. So I should pass in deep copies of the array using the slice function. Is that correct?

  • Custom User Avatar

    Hi again. My background is with Java so I'm pretty familiar with OOP. I was speaking from the point of view of encapsulation. Having said that, the properties in my JavaScript version are public so I suppose I've no cause to question the public variables in your translation!
    Thanks for the link on C# naming guidelines. I didn't know they differed from Java in that way.

  • Custom User Avatar

    Hiya. I hope this doesn't come across as pedantic, and I'm not that familiar with C#, but should the variable names be public and starting with a capital letter? Or are getters & setters considered to be overkill for this kind of challenge? Thought I'd better check what I was approving first!

  • Custom User Avatar

    I'm not sure what to do about that. Is it always necessary to have random tests when writing a kata?

  • Custom User Avatar

    Hmmm. I'm not quite sure what you mean by 'vulnerable to input modification'.
    I have basically randomized the number of 'matches' that are passed into the function.
    It's probably considered hacky, but this is the test that I wrote:

    for (let i = 0; i < 200; i++) {
    let matches = [];
    let limit = Math.floor(Math.random() * 20)
    for (let j = 0; j < limit; j++) {
    matches.push(['C1','C2']);
    }
    Test.assertDeepEquals(contestantSwapper(matches), contestantSwapperCheck(matches));
    }

  • Custom User Avatar

    Brilliant. Thank you!

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Ah yes, I initially had a different idea for the weight of the tennis balls and didn't update that test accordingly. I've since removed that test and updated the methods called on the Test object. Many thanks.

  • Custom User Avatar

    Thanks for the feedback! Random tests have now been added.