           (is (= (keys stored-content) (map :id stats))
               "enumerates all ids in sorted order")
           (is (every? #(= (:size %) (count (get stored-content (:id %)))) stats)
-              "returns correct size for all blocks")))
+              "returns correct size for all blocks"))
+        (test-list-stats store (keys stored-content) 100))
       (doseq [[id content] stored-content]
         (test-block store id content))
       (let [[id content] (first (seq stored-content))]

       (into (sorted-map))))


(defn test-block
  "Determines whether the store contains the content for the given identifier."
  [store id content]
  (testing "block stats"

  (:require
    [blocks.core :as block]
    [byte-streams :as bytes]
    [clojure.test :refer :all]
    [multihash.core :as multihash])
  (:import
    blocks.data.PersistentBytes))


(defn random-bytes
  "Returns a byte array between one and `max-len` bytes long with random
  content."
  [max-len]
  (let [size (inc (rand-int max-len))
        data (byte-array size)]
    (.nextBytes (java.security.SecureRandom.) data)
    data))


(defn random-hex
  "Returns a random hex string between one and `max-len` characters long."
  [max-len]
  (->> (repeatedly #(rand-nth "0123456789abcdef"))
       (take (inc (rand-int max-len)))
       (apply str)))


(defn populate-blocks!
