Skip to content

Commit

Permalink
Testing LRU-ness
Browse files Browse the repository at this point in the history
  • Loading branch information
fogus committed Mar 12, 2012
1 parent a052bb5 commit 582f86b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/clojure/clojure/core/cache.clj
Expand Up @@ -72,7 +72,7 @@
(empty [this#]
(seed this# (empty ~base-field)))
(equiv [_# other#]
(.equiv ~base-field other#))
(.equiv other# ~base-field))

clojure.lang.Seqable
(seq [_#]
Expand Down
6 changes: 6 additions & 0 deletions src/test/clojure/clojure/core/cache/tests.clj
Expand Up @@ -131,6 +131,12 @@
(do-assoc (LRUCache. {} {} 0 2))
(do-dissoc (LRUCache. {:a 1 :b 2} {} 0 2))))

(deftest test-lru-cache
(testing "LRU-ness"
(let [C (lru-cache-factory {} :limit 2)]
(are [x y] (= x y)
{:a 1, :b 2} (-> C (assoc :a 1) (assoc :b 2) .cache)))))

(deftest test-ttl-cache-ilookup
(testing "that the TTLCache can lookup via keywords"
(do-ilookup-tests (TTLCache. small-map {} 2)))
Expand Down

0 comments on commit 582f86b

Please sign in to comment.