-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scrabble-score: Implement tests (#653)
- Loading branch information
1 parent
cb82953
commit e4e6b2b
Showing
1 changed file
with
39 additions
and
13 deletions.
There are no files selected for viewing
52 changes: 39 additions & 13 deletions
52
exercises/practice/scrabble-score/test/scrabble_score_test.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,47 @@ | ||
(ns scrabble-score-test | ||
(:require [clojure.test :refer [deftest is]] | ||
(:require [clojure.test :refer [deftest testing is]] | ||
scrabble-score)) | ||
|
||
(deftest lower-case-letter | ||
(is (= 1 (scrabble-score/score-letter "a")))) | ||
(deftest lowercase-letter | ||
(testing "Lowercase letter" | ||
(is (= 1 (scrabble-score/score-word "a"))))) | ||
|
||
(deftest upper-case-letter | ||
(is (= 1 (scrabble-score/score-letter "A")))) | ||
(deftest uppercase-letter | ||
(testing "Uppercase letter" | ||
(is (= 1 (scrabble-score/score-word "A"))))) | ||
|
||
(deftest two-letter-word | ||
(is (= 2 (scrabble-score/score-word "at")))) | ||
(deftest valuable-letter | ||
(testing "Valuable letter" | ||
(is (= 4 (scrabble-score/score-word "f"))))) | ||
|
||
(deftest bigger-word-1 | ||
(is (= 6 (scrabble-score/score-word "street")))) | ||
(deftest short-word | ||
(testing "Short word" | ||
(is (= 2 (scrabble-score/score-word "at"))))) | ||
|
||
(deftest bigger-word-2 | ||
(is (= 22 (scrabble-score/score-word "quirky")))) | ||
(deftest short-valuable-word | ||
(testing "Short, valuable word" | ||
(is (= 12 (scrabble-score/score-word "zoo"))))) | ||
|
||
(deftest all-upper-case-word | ||
(is (= 41 (scrabble-score/score-word "OXYPHENBUTAZONE")))) | ||
(deftest medium-word | ||
(testing "Medium word" | ||
(is (= 6 (scrabble-score/score-word "street"))))) | ||
|
||
(deftest medium-valuable-word | ||
(testing "medium, valuable word" | ||
(is (= 22 (scrabble-score/score-word "quirky"))))) | ||
|
||
(deftest long-mixed-case-word | ||
(testing "Long, mixed-case word" | ||
(is (= 41 (scrabble-score/score-word "OxyphenButazone"))))) | ||
|
||
(deftest english-like-word | ||
(testing "English-like word" | ||
(is (= 8 (scrabble-score/score-word "pinata"))))) | ||
|
||
(deftest empty-input | ||
(testing "Empty input" | ||
(is (= 0 (scrabble-score/score-word ""))))) | ||
|
||
(deftest entire-alphabet-available | ||
(testing "Entire alphabet available" | ||
(is (= 87 (scrabble-score/score-word "abcdefghijklmnopqrstuvwxyz"))))) |