-
-
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.
eliuds-eggs: Add generators and regenerate tests (#811)
* add generators and regenerate tests * update function template
- Loading branch information
1 parent
90692f5
commit fcf3c22
Showing
3 changed files
with
27 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns eliuds-eggs-test | ||
(:require [clojure.test :refer [deftest testing is]] | ||
eliuds-eggs)) | ||
|
||
{{#test_cases.eggCount}} | ||
(deftest egg-count_test_{{idx}} | ||
(testing {{description}} | ||
(is (= {{expected}} (eliuds-eggs/egg-count {{input.number}}))))) | ||
{{/test_cases.eggCount}} |
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,5 +1,7 @@ | ||
(ns eliuds-eggs) | ||
|
||
(defn egg-count [number] | ||
;; your code goes here | ||
) | ||
(defn egg-count | ||
"Returns the number of 1 bits in the binary representation of the given number." | ||
[number] | ||
;; function body | ||
) |
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,15 +1,19 @@ | ||
(ns eliuds-eggs-test | ||
(:require [clojure.test :refer [deftest is]] | ||
(:require [clojure.test :refer [deftest testing is]] | ||
eliuds-eggs)) | ||
|
||
(deftest no-eggs | ||
(is (= 0 (eliuds-eggs/egg-count 0)))) | ||
(deftest egg-count_test_1 | ||
(testing "0 eggs" | ||
(is (= 0 (eliuds-eggs/egg-count 0))))) | ||
|
||
(deftest one-egg | ||
(is (= 1 (eliuds-eggs/egg-count 16)))) | ||
(deftest egg-count_test_2 | ||
(testing "1 egg" | ||
(is (= 1 (eliuds-eggs/egg-count 16))))) | ||
|
||
(deftest four-eggs | ||
(is (= 4 (eliuds-eggs/egg-count 89)))) | ||
(deftest egg-count_test_3 | ||
(testing "4 eggs" | ||
(is (= 4 (eliuds-eggs/egg-count 89))))) | ||
|
||
(deftest thirteen-eggs | ||
(is (= 13 (eliuds-eggs/egg-count 2000000000)))) | ||
(deftest egg-count_test_4 | ||
(testing "13 eggs" | ||
(is (= 13 (eliuds-eggs/egg-count 2000000000))))) |