Created
August 8, 2009 04:07
-
-
Save francoisdevlin/164291 to your computer and use it in GitHub Desktop.
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
;These tests are how Sean Devlin proposes that this function should behave. | |
(deftest test-flatten-proposed | |
(are [expected nested-val] (= (flatten nested-val) expected) | |
;simple literals | |
nil nil | |
1 1 | |
'foo 'foo | |
:keyword :keyword | |
1/2 1/2 | |
#"[\r\n]" #"[\r\n]" | |
true true | |
false false | |
"bar" "bar" | |
;vectors | |
[] [] | |
[1 2 3 4 5] [[1 2] [3 4 [5]]] | |
[1 2 3 4 5] [1 2 3 4 5] | |
[1 2 3 4 5] [#{1 2} 3 4 5] | |
;sets | |
[] #{} | |
[1 2 3 4 5] #{#{1 2} 3 4 5} | |
;lists | |
[] '() | |
[1 2 3 4 5] '(1 2 3 4 5) | |
[1 2 3 4 5] '(#{1 2} 3 4 5) | |
;maps | |
[:a 1 :b 2] {:a 1 :b 2} | |
[:a :b 1 :c 2] {[:a :b] 1 :c 2} | |
[:a 1 2 :b 3] {:a [1 2] :b 3} | |
;fns | |
count count)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment