Skip to content

Commit

Permalink
scrabble-score: Implement tests (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
tasxatzial authored Jul 17, 2024
1 parent cb82953 commit e4e6b2b
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions exercises/practice/scrabble-score/test/scrabble_score_test.clj
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")))))

0 comments on commit e4e6b2b

Please sign in to comment.