-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
raindrops: Implement tests from problem specifications
- Loading branch information
1 parent
7b46e1f
commit 0280123
Showing
1 changed file
with
57 additions
and
33 deletions.
There are no files selected for viewing
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,51 +1,75 @@ | ||
(ns raindrops-test | ||
(:require [clojure.test :refer [deftest is]] | ||
(:require [clojure.test :refer [deftest is testing]] | ||
raindrops)) | ||
|
||
(deftest one | ||
(is (= "1" (raindrops/convert 1)))) | ||
(deftest sound-for-1 | ||
(testing "The sound for 1 is 1" | ||
(is (= "1" (raindrops/convert 1))))) | ||
|
||
(deftest three | ||
(is (= "Pling" (raindrops/convert 3)))) | ||
(deftest sound-for-3 | ||
(testing "The sound for 3 is Pling" | ||
(is (= "Pling" (raindrops/convert 3))))) | ||
|
||
(deftest five | ||
(is (= "Plang" (raindrops/convert 5)))) | ||
(deftest sound-for-5 | ||
(testing "The sound for 5 is Plang" | ||
(is (= "Plang" (raindrops/convert 5))))) | ||
|
||
(deftest seven | ||
(is (= "Plong" (raindrops/convert 7)))) | ||
(deftest sound-for-7 | ||
(testing "The sound for 7 is Plong" | ||
(is (= "Plong" (raindrops/convert 7))))) | ||
|
||
(deftest six | ||
(is (= "Pling" (raindrops/convert 6)))) | ||
(deftest sound-for-6 | ||
(testing "The sound for 6 is Pling as it has a factor 3" | ||
(is (= "Pling" (raindrops/convert 6))))) | ||
|
||
(deftest nine | ||
(is (= "Pling" (raindrops/convert 9)))) | ||
(deftest sound-for-8 | ||
(testing "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" | ||
(is (= "8" (raindrops/convert 8))))) | ||
|
||
(deftest ten | ||
(is (= "Plang" (raindrops/convert 10)))) | ||
(deftest sound-for-9 | ||
(testing "The sound for 9 is Pling as it has a factor 3" | ||
(is (= "Pling" (raindrops/convert 9))))) | ||
|
||
(deftest fourteen | ||
(is (= "Plong" (raindrops/convert 14)))) | ||
(deftest sound-for-10 | ||
(testing "The sound for 10 is Plang as it has a factor 5" | ||
(is (= "Plang" (raindrops/convert 10))))) | ||
|
||
(deftest fifteen | ||
(is (= "PlingPlang" (raindrops/convert 15)))) | ||
(deftest sound-for-14 | ||
(testing "The sound for 14 is Plong as it has a factor of 7" | ||
(is (= "Plong" (raindrops/convert 14))))) | ||
|
||
(deftest twenty-one | ||
(is (= "PlingPlong" (raindrops/convert 21)))) | ||
(deftest sound-for-15 | ||
(testing "The sound for 15 is PlingPlang as it has factors 3 and 5" | ||
(is (= "PlingPlang" (raindrops/convert 15))))) | ||
|
||
(deftest twenty-five | ||
(is (= "Plang" (raindrops/convert 25)))) | ||
(deftest sound-for-21 | ||
(testing "The sound for 21 is PlingPlong as it has factors 3 and 7" | ||
(is (= "PlingPlong" (raindrops/convert 21))))) | ||
|
||
(deftest thirty-five | ||
(is (= "PlangPlong" (raindrops/convert 35)))) | ||
(deftest sound-for-25 | ||
(testing "The sound for 25 is Plang as it has a factor 5" | ||
(is (= "Plang" (raindrops/convert 25))))) | ||
|
||
(deftest forty-nine | ||
(is (= "Plong" (raindrops/convert 49)))) | ||
(deftest sound-for-27 | ||
(testing "The sound for 27 is Pling as it has a factor 3" | ||
(is (= "Pling" (raindrops/convert 27))))) | ||
|
||
(deftest fifty-two | ||
(is (= "52" (raindrops/convert 52)))) | ||
(deftest sound-for-35 | ||
(testing "The sound for 35 is PlangPlong as it has factors 5 and 7" | ||
(is (= "PlangPlong" (raindrops/convert 35))))) | ||
|
||
(deftest one-hundred-five | ||
(is (= "PlingPlangPlong" (raindrops/convert 105)))) | ||
(deftest sound-for-49 | ||
(testing "The sound for 49 is Plong as it has a factor 7" | ||
(is (= "Plong" (raindrops/convert 49))))) | ||
|
||
(deftest twelve-thousand-one-hundred-twenty-one | ||
(is (= "12121" (raindrops/convert 12121)))) | ||
(deftest sound-for-52 | ||
(testing "The sound for 52 is 52" | ||
(is (= "52" (raindrops/convert 52))))) | ||
|
||
(deftest sound-for-105 | ||
(testing "The sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" | ||
(is (= "PlingPlangPlong" (raindrops/convert 105))))) | ||
|
||
(deftest sound-for-3125 | ||
(testing "The sound for 3125 is Plang as it has a factor 5" | ||
(is (= "Plang" (raindrops/convert 3125))))) |