From 93312dcaa4376704b5b079e44a53169a37220299 Mon Sep 17 00:00:00 2001 From: Marko <marko.tsengov@gmail.com> Date: Sun, 14 Jul 2019 23:14:18 +0300 Subject: [PATCH] anagram 1.5.0: Add test cases for differently-cased words Add two test cases to catch some weird solutions where all words are rejected if the matched words have different case. https://github.com/exercism/cpp/pull/297 https://github.com/exercism/problem-specifications/pull/1552 --- exercises/anagram/source/anagram/AnagramTest.ceylon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercises/anagram/source/anagram/AnagramTest.ceylon b/exercises/anagram/source/anagram/AnagramTest.ceylon index 5d46a8b..a54db82 100644 --- a/exercises/anagram/source/anagram/AnagramTest.ceylon +++ b/exercises/anagram/source/anagram/AnagramTest.ceylon @@ -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 @@ -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 @@ -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