diff --git a/exercises/practice/anagram/.meta/config.json b/exercises/practice/anagram/.meta/config.json index 86ac6e0dce..42cb3ee2a3 100644 --- a/exercises/practice/anagram/.meta/config.json +++ b/exercises/practice/anagram/.meta/config.json @@ -8,6 +8,7 @@ "draalger", "gabriel376", "gargrave", + "jagdish-15", "kytrinyx", "matthewmorgan", "ovidiu141", diff --git a/exercises/practice/anagram/.meta/tests.toml b/exercises/practice/anagram/.meta/tests.toml index 6c507d257f..4d90562705 100644 --- a/exercises/practice/anagram/.meta/tests.toml +++ b/exercises/practice/anagram/.meta/tests.toml @@ -46,12 +46,41 @@ description = "detects anagrams using case-insensitive possible matches" [7cc195ad-e3c7-44ee-9fd2-d3c344806a2c] description = "does not detect an anagram if the original word is repeated" +include = false + +[630abb71-a94e-4715-8395-179ec1df9f91] +description = "does not detect an anagram if the original word is repeated" +reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c" [9878a1c9-d6ea-4235-ae51-3ea2befd6842] description = "anagrams must use all letters exactly once" [85757361-4535-45fd-ac0e-3810d40debc1] description = "words are not anagrams of themselves (case-insensitive)" +include = false + +[68934ed0-010b-4ef9-857a-20c9012d1ebf] +description = "words are not anagrams of themselves" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" + +[589384f3-4c8a-4e7d-9edc-51c3e5f0c90e] +description = "words are not anagrams of themselves even if letter case is partially different" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" + +[ba53e423-7e02-41ee-9ae2-71f91e6d18e6] +description = "words are not anagrams of themselves even if letter case is completely different" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" [a0705568-628c-4b55-9798-82e4acde51ca] description = "words other than themselves can be anagrams" +include = false + +[33d3f67e-fbb9-49d3-a90e-0beb00861da7] +description = "words other than themselves can be anagrams" +reimplements = "a0705568-628c-4b55-9798-82e4acde51ca" + +[a6854f66-eec1-4afd-a137-62ef2870c051] +description = "handles case of greek letters" + +[fd3509e5-e3ba-409d-ac3d-a9ac84d13296] +description = "different characters may have the same bytes" diff --git a/exercises/practice/anagram/anagram.spec.js b/exercises/practice/anagram/anagram.spec.js index c6dfe5385c..dc011aea9e 100644 --- a/exercises/practice/anagram/anagram.spec.js +++ b/exercises/practice/anagram/anagram.spec.js @@ -96,7 +96,7 @@ describe('Anagram', () => { xtest('does not detect an anagram if the original word is repeated', () => { const expected = []; - const actual = findAnagrams('go', ['go Go GO']); + const actual = findAnagrams('go', ['goGoGO']); expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); }); @@ -106,15 +106,39 @@ describe('Anagram', () => { expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); }); - xtest('words are not anagrams of themselves (case-insensitive)', () => { + xtest('words are not anagrams of themselves', () => { const expected = []; - const actual = findAnagrams('BANANA', ['BANANA', 'Banana', 'banana']); + const actual = findAnagrams('BANANA', ['BANANA']); + expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); + }); + + xtest('words are not anagrams of themselves even if letter case is partially different', () => { + const expected = []; + const actual = findAnagrams('BANANA', ['Banana']); + expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); + }); + + xtest('words are not anagrams of themselves even if letter case is completely different', () => { + const expected = []; + const actual = findAnagrams('BANANA', ['banana']); expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); }); xtest('words other than themselves can be anagrams', () => { const expected = ['Silent']; - const actual = findAnagrams('LISTEN', ['Listen', 'Silent', 'LISTEN']); + const actual = findAnagrams('LISTEN', ['LISTEN', 'Silent']); + expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); + }); + + xtest('handles case of greek letters', () => { + const expected = ['ΒΓΑ', 'γβα']; + const actual = findAnagrams('ΑΒΓ', ['ΒΓΑ', 'ΒΓΔ', 'γβα', 'αβγ']); + expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); + }); + + xtest('different characters may have the same bytes', () => { + const expected = []; + const actual = findAnagrams('a⬂', ['€a']); expect(areSetsEqual(new Set(expected), new Set(actual))).toEqual(true); }); });