Ad
  • Custom User Avatar
  • Custom User Avatar

    I wrote this to pass a kata for points, not for you to read. If you want to read stuff that will actually educate you, I recommend my stack overflow answers or my blog.

  • Custom User Avatar

    Because this is a test which has a purpose of specifically checking that your solution obeys the "don't mutate the input" requirement.

    There're many katas which have tests for specific requirements, the most obvious example would be parsers/interpreters/transpilers...

  • Custom User Avatar

    There's a message below specially for people like you:

    If your code can't pass the mutation test, READ THIS. I'm gonna explain it once here. It's not testing the output of your function, it's testing the input before your function against its value after your function is called. So, it's perfectly normal it expects both values to match. If they don't, you've mutated its value. Go read the docs on whatever method you applied to the array/list in whatever language you used. See how they work and fix your code.

  • Custom User Avatar

    But do you not mutate the original array/list as the description says?