r icon indicating copy to clipboard operation
r copied to clipboard

test(anagram): clean up redundant tests

Open ofhope opened this issue 1 year ago • 2 comments

I tried to open this a few months ago during a hiatus. Reopening again 🤞🏽 https://github.com/exercism/r/pull/233

Going through this exercise I notice a fair bit of redundant testing. They loose value when duplicated and make it harder to establish the expected result.

Removed multiple tests for "detects multiple anagrams" Removed multiple tests for "anagrams must use all letters exactly once" Removed multiple test for "case insensitive checking" Clarified test descriptions

ofhope avatar Jun 12 '23 23:06 ofhope

I think I'll close this down. It looks like the specification has duplication meaning these tests would need to reflect that.

Test cases are immutable with only description, comments or scenario additions being allowed.

Test cases are immutable, which means that once a test case has been added, it never changes.

So every language track needs to implement redundant tests to align with this problem specification. It makes sense to make them immutable so the many dependant language tracks don't fall out of alignment and aren't routinely having to sync. But the OCD in me has a little eye twitch while reading this specification 😄

Duplicate test example (the candidates input are slightly different but from a test perspective I would call them identical).

{
  "uuid": "a0705568-628c-4b55-9798-82e4acde51ca",
  "description": "words other than themselves can be anagrams",
  "property": "findAnagrams",
  "input": {
    "subject": "LISTEN",
    "candidates": [
      "Listen",
      "Silent",
      "LISTEN"
    ]
  },
  "expected": [
    "Silent"
  ]
},
{
  "uuid": "33d3f67e-fbb9-49d3-a90e-0beb00861da7",
  "reimplements": "a0705568-628c-4b55-9798-82e4acde51ca",
  "description": "words other than themselves can be anagrams",
  "property": "findAnagrams",
  "input": {
    "subject": "LISTEN",
    "candidates": [
      "LISTEN",
      "Silent"
    ]
  },
  "expected": [
    "Silent"
  ]
}

ofhope avatar Jul 26 '23 21:07 ofhope

Oh... wait I just noticed the field reimplements and see the section "Changing Tests". I'll take a closer look at this specification and see if I can align it.

ofhope avatar Jul 26 '23 21:07 ofhope