From 376f48e531015a4e03430ec37241e8403a93b673 Mon Sep 17 00:00:00 2001 From: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com> Date: Sat, 9 Nov 2024 13:43:59 +0200 Subject: [PATCH 1/5] sync tests --- exercises/practice/isogram/.meta/tests.toml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/exercises/practice/isogram/.meta/tests.toml b/exercises/practice/isogram/.meta/tests.toml index 7187c340..ba04c664 100644 --- a/exercises/practice/isogram/.meta/tests.toml +++ b/exercises/practice/isogram/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [a0e97d2d-669e-47c7-8134-518a1e2c4555] description = "empty string" @@ -40,3 +47,6 @@ description = "duplicated character in the middle" [310ac53d-8932-47bc-bbb4-b2b94f25a83e] description = "same first and last characters" + +[0d0b8644-0a1e-4a31-a432-2b3ee270d847] +description = "word with duplicated character and with two hyphens" From 4339766b6b448965a8ce1ea57c7cc5d2f5524f43 Mon Sep 17 00:00:00 2001 From: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com> Date: Sat, 9 Nov 2024 13:46:40 +0200 Subject: [PATCH 2/5] update starter file --- exercises/practice/isogram/src/isogram.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exercises/practice/isogram/src/isogram.clj b/exercises/practice/isogram/src/isogram.clj index fe9fedf4..9cc1b890 100644 --- a/exercises/practice/isogram/src/isogram.clj +++ b/exercises/practice/isogram/src/isogram.clj @@ -1,5 +1,7 @@ (ns isogram) -(defn isogram? [] ;; <- arglist goes here - ;; your code goes here -) +(defn isogram? + "Returns true if the given string is an isogram; otherwise, returns false" + [s] + ;; function body + ) From 29a7b3e7e5cff2ba98fb76a2a2958d45a331e99d Mon Sep 17 00:00:00 2001 From: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:21:12 +0200 Subject: [PATCH 3/5] implement tests --- .../practice/isogram/test/isogram_test.clj | 70 +++++++++++++++---- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/exercises/practice/isogram/test/isogram_test.clj b/exercises/practice/isogram/test/isogram_test.clj index 5c2cf69a..39734efd 100644 --- a/exercises/practice/isogram/test/isogram_test.clj +++ b/exercises/practice/isogram/test/isogram_test.clj @@ -1,17 +1,59 @@ (ns isogram-test - (:require [clojure.test :refer [deftest is]] + (:require [clojure.test :refer [deftest testing is]] isogram)) -(deftest test-isograms - (is (isogram/isogram? "duplicates")) - (is (isogram/isogram? "subdermatoglyphic")) - (is (isogram/isogram? "thumbscrew-japingly")) - (is (isogram/isogram? "Hjelmqvist-Gryb-Zock-Pfund-Wax")) - (is (isogram/isogram? "Heizölrückstoßabdämpfung")) - (is (isogram/isogram? "Emily Jung Schwartzkopf"))) - -(deftest test-non-isograms - (is (not (isogram/isogram? "eleven"))) - (is (not (isogram/isogram? "Alphabet"))) - (is (not (isogram/isogram? "the quick brown fox"))) - (is (not (isogram/isogram? "éléphant")))) +(deftest test-a0e97d2d-669e-47c7-8134-518a1e2c4555 + (testing "empty string" + (is (true? (isogram/isogram? ""))))) + +(deftest test-9a001b50-f194-4143-bc29-2af5ec1ef652 + (testing "isogram with only lower case characters" + (is (true? (isogram/isogram? "isogram"))))) + +(deftest test-8ddb0ca3-276e-4f8b-89da-d95d5bae78a4 + (testing "word with one duplicated character" + (is (false? (isogram/isogram? "eleven"))))) + +(deftest test-6450b333-cbc2-4b24-a723-0b459b34fe18 + (testing "word with one duplicated character from the end of the alphabet" + (is (false? (isogram/isogram? "zzyzx"))))) + +(deftest test-a15ff557-dd04-4764-99e7-02cc1a385863 + (testing "longest reported english isogram" + (is (true? (isogram/isogram? "subdermatoglyphic"))))) + +(deftest test-f1a7f6c7-a42f-4915-91d7-35b2ea11c92e + (testing "word with duplicated character in mixed case" + (is (false? (isogram/isogram? "Alphabet"))))) + +(deftest test-14a4f3c1-3b47-4695-b645-53d328298942 + (testing "word with duplicated character in mixed case, lowercase first" + (is (false? (isogram/isogram? "alphAbet"))))) + +(deftest test-423b850c-7090-4a8a-b057-97f1cadd7c42 + (testing "hypothetical isogrammic word with hyphen" + (is (true? (isogram/isogram? "thumbscrew-japingly"))))) + +(deftest test-93dbeaa0-3c5a-45c2-8b25-428b8eacd4f2 + (testing "hypothetical word with duplicated character following hyphen" + (is (false? (isogram/isogram? "thumbscrew-jappingly"))))) + +(deftest test-36b30e5c-173f-49c6-a515-93a3e825553f + (testing "isogram with duplicated hyphen" + (is (true? (isogram/isogram? "six-year-old"))))) + +(deftest test-cdabafa0-c9f4-4c1f-b142-689c6ee17d93 + (testing "made-up name that is an isogram" + (is (true? (isogram/isogram? "Emily Jung Schwartzkopf"))))) + +(deftest test-5fc61048-d74e-48fd-bc34-abfc21552d4d + (testing "duplicated character in the middle" + (is (false? (isogram/isogram? "accentor"))))) + +(deftest test-310ac53d-8932-47bc-bbb4-b2b94f25a83e + (testing "same first and last characters" + (is (false? (isogram/isogram? "angola"))))) + +(deftest test-0d0b8644-0a1e-4a31-a432-2b3ee270d847 + (testing "word with duplicated character and with two hyphens" + (is (false? (isogram/isogram? "up-to-date"))))) From f8704da010b1b3a9dbe11a68e814c1e314020690 Mon Sep 17 00:00:00 2001 From: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:22:15 +0200 Subject: [PATCH 4/5] update example solution so that it passes the tests --- exercises/practice/isogram/.meta/src/example.clj | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/exercises/practice/isogram/.meta/src/example.clj b/exercises/practice/isogram/.meta/src/example.clj index ce0b8c14..5f53825a 100644 --- a/exercises/practice/isogram/.meta/src/example.clj +++ b/exercises/practice/isogram/.meta/src/example.clj @@ -1,5 +1,10 @@ -(ns isogram - (:require [clojure.string :as str])) +(ns isogram) -(defn isogram? [word] - (apply distinct? (filter #(Character/isLetter %) (str/lower-case word)))) +(defn isogram? + [s] + (->> s + clojure.string/lower-case + (filter #(Character/isAlphabetic (int %))) + frequencies + vals + (every? #{1}))) From dc31554665e049718ecc5711878155f83f14fb61 Mon Sep 17 00:00:00 2001 From: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:22:37 +0200 Subject: [PATCH 5/5] update config --- exercises/practice/isogram/.meta/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/practice/isogram/.meta/config.json b/exercises/practice/isogram/.meta/config.json index a4281a28..0f79465e 100644 --- a/exercises/practice/isogram/.meta/config.json +++ b/exercises/practice/isogram/.meta/config.json @@ -6,7 +6,8 @@ "AndreaCrotti", "haus", "sjwarner-bp", - "yurrriq" + "yurrriq", + "tasxatzial" ], "files": { "solution": [