Skip to content

Commit

Permalink
anagram 1.5.0: Add test cases for differently-cased words
Browse files Browse the repository at this point in the history
Add two test cases to catch some weird solutions where all words are
rejected if the matched words have different case.

exercism/cpp#297
exercism/problem-specifications#1552
  • Loading branch information
marko213 authored and petertseng committed Sep 1, 2019
1 parent 698c628 commit 93312dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions exercises/anagram/source/anagram/AnagramTest.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ceylon.test {
...
}

// Tests adapted from problem-specifications version 1.4.1
// Tests adapted from problem-specifications version 1.5.0

{[String, {String*}, {String*}]*} cases => {
// no matches
Expand All @@ -19,6 +19,8 @@ import ceylon.test {
{ "gallery", "ballerina", "regally", "clergy", "largely", "leading" },
{ "gallery", "regally", "largely" }
],
// detects multiple anagrams with different case
["nose", { "Eons", "ONES" }, { "Eons", "ONES" }],
// does not detect non-anagrams with identical checksum
["mass", { "last" }, {}],
// detects anagrams case-insensitively
Expand All @@ -32,7 +34,9 @@ import ceylon.test {
// anagrams must use all letters exactly once
["tapper", { "patter" }, {}],
// words are not anagrams of themselves (case-insensitive)
["BANANA", { "BANANA", "Banana", "banana" }, {}]
["BANANA", { "BANANA", "Banana", "banana" }, {}],
// words other than themselves can be anagrams
["LISTEN", { "Listen", "Silent", "LISTEN" }, { "Silent" }]
};

test
Expand Down

0 comments on commit 93312dc

Please sign in to comment.