Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrabble-score: add generator and regenerate tests #737

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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~}}
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")))))