Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Testing LRU-ness

  • Loading branch information...
commit 582f86b429eed5bfaebe1e05783a3a113784a317 1 parent a052bb5
@fogus fogus authored
View
2  src/main/clojure/clojure/core/cache.clj
@@ -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 [_#]
View
6 src/test/clojure/clojure/core/cache/tests.clj
@@ -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)))
Please sign in to comment.
Something went wrong with that request. Please try again.