Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions exercises/practice/anagram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ 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"
Expand Down Expand Up @@ -73,3 +78,9 @@ 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"
18 changes: 17 additions & 1 deletion exercises/practice/anagram/anagram.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('Anagram', () => {

xit('does not detect an anagram if the original word is repeated', () => {
const subject = new Anagram('go')
const matches = subject.matches('go Go GO')
const matches = subject.matches('goGoGO')
const expected = []

expect(areSetsEqual(new Set(expected), new Set(matches))).toEqual(true)
Expand Down Expand Up @@ -140,6 +140,22 @@ describe('Anagram', () => {
expect(areSetsEqual(new Set(expected), new Set(matches))).toEqual(true)
})

xit('handles case of greek letters', () => {
const subject = new Anagram('ΑΒΓ')
const matches = subject.matches('ΒΓΑ', 'ΒΓΔ', 'γβα', 'αβγ')
const expected = ['ΒΓΑ', 'γβα']

expect(areSetsEqual(new Set(expected), new Set(matches))).toEqual(true)
})

xit('different characters may have the same bytes', () => {
const subject = new Anagram('a⬂')
const matches = subject.matches('€a')
const expected = []

expect(areSetsEqual(new Set(expected), new Set(matches))).toEqual(true)
})

xit('matches() accepts string arguments', () => {
const subject = new Anagram('ant')
const matches = subject.matches('stand', 'tan', 'at')
Expand Down
Loading