File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ ; ; https://4clojure.oxal.org/#/problem/065
2
+
3
+ (ns ex.q065 )
4
+
5
+ (defn ans
6
+ " Problem 65, Black Box Testing"
7
+ [coll]
8
+ (cond
9
+ (= :kun (:david (conj coll [:david :kun ]))) :map
10
+ (= (inc (count coll)) (count (conj coll [:david :kun ] [:david :kun ]))) :set
11
+ (= :kun (first (conj coll :david :kun ))) :list
12
+ (= :kun (last (conj coll :david :kun ))) :vector
13
+ :else :unknown ))
Original file line number Diff line number Diff line change
1
+ ; ; https://4clojure.oxal.org/#/problem/065
2
+
3
+ (ns ex.q065-test
4
+ (:require [clojure.test :as t]
5
+ [ex.q065 :as sut]))
6
+
7
+ (t/deftest test-q65
8
+ (t/testing " Problem 65, Black Box Testing"
9
+ (t/is (= :map (sut/ans {:a 1 , :b 2 })))
10
+ (t/is (= :list (sut/ans (range (rand-int 20 )))))
11
+ (t/is (= :vector (sut/ans [1 2 3 4 5 6 ])))
12
+ (t/is (= [:map :set :vector :list ] (map sut/ans [{} #{} [] ()])))))
You can’t perform that action at this time.
0 commit comments