Skip to content

Commit

Permalink
scrabble-score: update to latest (#737)
Browse files Browse the repository at this point in the history
* scrabble-score: add generator and regenerate tests

[no important files changed]

* Update exercises/practice/scrabble-score/test/scrabble_score_test.clj

Co-authored-by: Anastasios Chatzialexiou <[email protected]>

---------

Co-authored-by: Anastasios Chatzialexiou <[email protected]>
  • Loading branch information
ErikSchierboom and tasxatzial authored Jan 13, 2025
1 parent 5c28e85 commit 25a34f0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
8 changes: 8 additions & 0 deletions exercises/practice/scrabble-score/.meta/generator.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns scrabble-score-test
(:require [clojure.test :refer [deftest testing is]]
scrabble-score))
{{#test_cases.score}}
(deftest score-word_test_{{idx}}
(testing "{{description}}"
(is (= {{expected}} (scrabble-score/score-word "{{input.word}}")))))
{{/test_cases.score~}}
12 changes: 5 additions & 7 deletions exercises/practice/scrabble-score/src/scrabble_score.clj
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
(ns scrabble-score)

(defn score-letter [] ;; <- arglist goes here
;; your code goes here
)

(defn score-word [] ;; <- arglist goes here
;; your code goes here
)
(defn score-word
"Calculate a word's scrabble score"
[word]
;; function body
)
42 changes: 21 additions & 21 deletions exercises/practice/scrabble-score/test/scrabble_score_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@
(:require [clojure.test :refer [deftest testing is]]
scrabble-score))

(deftest lowercase-letter
(testing "Lowercase letter"
(deftest score-word_test_1
(testing "lowercase letter"
(is (= 1 (scrabble-score/score-word "a")))))

(deftest uppercase-letter
(testing "Uppercase letter"
(deftest score-word_test_2
(testing "uppercase letter"
(is (= 1 (scrabble-score/score-word "A")))))

(deftest valuable-letter
(testing "Valuable letter"
(deftest score-word_test_3
(testing "valuable letter"
(is (= 4 (scrabble-score/score-word "f")))))

(deftest short-word
(testing "Short word"
(deftest score-word_test_4
(testing "short word"
(is (= 2 (scrabble-score/score-word "at")))))

(deftest short-valuable-word
(testing "Short, valuable word"
(deftest score-word_test_5
(testing "short, valuable word"
(is (= 12 (scrabble-score/score-word "zoo")))))

(deftest medium-word
(testing "Medium word"
(deftest score-word_test_6
(testing "medium word"
(is (= 6 (scrabble-score/score-word "street")))))

(deftest medium-valuable-word
(deftest score-word_test_7
(testing "medium, valuable word"
(is (= 22 (scrabble-score/score-word "quirky")))))

(deftest long-mixed-case-word
(testing "Long, mixed-case word"
(deftest score-word_test_8
(testing "long, mixed-case word"
(is (= 41 (scrabble-score/score-word "OxyphenButazone")))))

(deftest english-like-word
(testing "English-like word"
(deftest score-word_test_9
(testing "english-like word"
(is (= 8 (scrabble-score/score-word "pinata")))))

(deftest empty-input
(testing "Empty input"
(deftest score-word_test_10
(testing "empty input"
(is (= 0 (scrabble-score/score-word "")))))

(deftest entire-alphabet-available
(testing "Entire alphabet available"
(deftest score-word_test_11
(testing "entire alphabet available"
(is (= 87 (scrabble-score/score-word "abcdefghijklmnopqrstuvwxyz")))))

0 comments on commit 25a34f0

Please sign in to comment.