Last active
March 7, 2017 21:39
-
-
Save deque-blog/015b4ce251237afe3d3fd840b98c8fe1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(deftest test-pick-n-of-each | |
(let [pick-n-of-each (comp vec algo/pick-n-of-each)] | |
(testing "Varying number of each group" | |
(are | |
[expected n] (= expected (pick-n-of-each n (range) [:a :b])) | |
[] 0 | |
[[0 :a] [1 :b]] 1 | |
[[0 :a] [1 :a] [2 :b] [3 :b]] 2 | |
)) | |
(testing "Varying number of groups" | |
(are | |
[expected groups] (= expected (pick-n-of-each 2 (range) groups)) | |
[] [] | |
[[0 :a] [1 :a]] [:a] | |
)) | |
(testing "No elements to choose from" | |
(is | |
(= [] (pick-n-of-each 1 [] [:a])) | |
)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment