Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
29 changes: 29 additions & 0 deletions exercises/practice/anagram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,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"
71 changes: 67 additions & 4 deletions exercises/practice/anagram/AnagramTests.vb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tests here need to be resorted so the order that's in the tests.toml. That'll make it easier to spot things that aren't canonical.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Public Class AnagramTest
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
<Fact>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Fact>
<Fact(Skip:="Remove this Skip property to run this test")>

Only the first test in the entire suite should be unskipped. Every subsequent test is skipped so the student ideally unskips them one at a time.

Public Sub DetectMultipleAnagrams()
Dim detector = New Anagram("master")
Dim words = {"stream", "pigeon", "maters"}
Dim expected = {"maters", "stream"}
Dim detector = New Anagram("solemn")
Dim words = {"lemons", "cherry", "melons"}
Dim expected = {"lemons", "melons"}
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub
Expand All @@ -35,6 +35,42 @@ Public Class AnagramTest
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub OriginalWordRepeated()
Dim detector = New Anagram("go")
Dim words = {"goGoGO"}
Dim expected = Array.Empty(Of String)()
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub BananaIsNotAnagramOfItself()
Dim detector = New Anagram("BANANA")
Dim words = {"BANANA"}
Dim expected = Array.Empty(Of String)()
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub BananaDifferentCaseIsNotAnagram()
Dim detector = New Anagram("BANANA")
Dim words = {"Banana"}
Dim expected = Array.Empty(Of String)()
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub BananaCompletelyDifferentCaseIsNotAnagram()
Dim detector = New Anagram("BANANA")
Dim words = {"banana"}
Dim expected = Array.Empty(Of String)()
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isn't in the problem specifications and should be removed.

Public Sub IdenticalWordIsNotAnagram()
Dim detector = New Anagram("corn")
Expand Down Expand Up @@ -81,4 +117,31 @@ Public Class AnagramTest
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub ListenHasSilentAsAnagram()
Dim detector = New Anagram("LISTEN")
Dim words = {"LISTEN", "Silent"}
Dim expected = {"Silent"}
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub GreekLettersAreHandledCaseInsensitively()
Dim detector = New Anagram("ΑΒΓ")
Dim words = {"ΒΓΑ", "ΒΓΔ", "γβα", "αβγ"}
Dim expected = {"ΒΓΑ", "γβα"}
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub DifferentCharactersWithSameBytesAreNotAnagrams()
Dim detector = New Anagram("a⬂")
Dim words = {"€a"}
Dim expected = Array.Empty(Of String)()
Dim result as IEnumerable(Of String) = detector.Match(words)
Assert.Equal(expected, result)
End Sub

End Class