Skip to content

Commit

Permalink
patch: remove order dependency from anagram test cases
Browse files Browse the repository at this point in the history
It was raised in the form that the canonical problem specifications have
several flaws:
- vague language
- are not congruent with the existing tests in many tracks

This change list removes the dependency on the order of the returned
words that have been validated as candidates.
  • Loading branch information
neenjaw committed Jan 16, 2025
1 parent ad095ee commit a79de59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions exercises/practice/anagram/test/anagram_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule AnagramTest do
@tag :pending
test "detects two anagrams" do
matches = Anagram.match("solemn", ~w(lemons cherry melons))
assert matches == ~w(lemons melons)
assert Enum.sort(matches) == Enum.sort(~w(lemons melons))
end

@tag :pending
Expand All @@ -28,13 +28,13 @@ defmodule AnagramTest do
@tag :pending
test "detects three anagrams" do
matches = Anagram.match("allergy", ~w(gallery ballerina regally clergy largely leading))
assert matches == ~w(gallery regally largely)
assert Enum.sort(matches) == Enum.sort(~w(gallery regally largely))
end

@tag :pending
test "detects multiple anagrams with different case" do
matches = Anagram.match("nose", ~w(Eons ONES))
assert matches == ~w(Eons ONES)
assert Enum.sort(matches) == Enum.sort(~w(Eons ONES))
end

@tag :pending
Expand Down Expand Up @@ -100,7 +100,7 @@ defmodule AnagramTest do
@tag :pending
test "handles case of greek letters" do
matches = Anagram.match("ΑΒΓ", ~w(ΒΓΑ ΒΓΔ γβα αβγ))
assert matches == ~w(ΒΓΑ γβα)
assert Enum.sort(matches) == Enum.sort(~w(ΒΓΑ γβα))
end

@tag :pending
Expand Down

0 comments on commit a79de59

Please sign in to comment.