Skip to content

Instantly share code, notes, and snippets.

@puredanger
Created August 30, 2012 20:54
Show Gist options
  • Save puredanger/3540715 to your computer and use it in GitHub Desktop.
Save puredanger/3540715 to your computer and use it in GitHub Desktop.
tests for sub=
(deftest test-sub=
(are [expected left right] (= expected (sub= left right))
;; prim
true 1 1
false 1 2
;; maps
true {} {:a 1}
false {:a 1} {}
true {:a 1} {:a 1}
false {:a 1} {:a 2}
true {:a 1} {:a 1 :b 2}
;; nested maps
true {} {:a {:b 1}}
false {:a 1} {:b {:c 2}}
true {:a {:b 1}} {:a {:b 1}}
true {:a {:b 1}} {:a {:b 1 :c 2}}
true {:a {}} {:a {:b 1}}
false {:a {:b 1}} {:a 1}
false {:a {:b 1}} {:a {:b 2}}
true {:a {:b 1}} {:a {:b 1 :c 2}}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment