           (recur matcher byte-arrays (conj matches index))
           (recur matcher (next byte-arrays) matches)))
       matches)))
-
-(defn the-bytes [x]
-  (.getBytes x))
-
-(defn test-index [m x]
-  (let [[index _] (if (string? x)
-                    (search-bytes m (the-bytes x))
-                    (reduce index-of-reducer [0 m] (map the-bytes x)))]
-    index))
 
 (deftest a-test
   (testing "border generation"

  (:require [clojure.test :refer :all]
            [kmp-search.core :refer :all]))

(defn index-of-reducer
  [[_ matcher] bytes]
  (let [[index matcher] (search-bytes matcher bytes)]
    (if index
      (reduced [index matcher])
      [index matcher])))

(defn all-matches
  [pattern byte-arrays]

         [-1 0 0 0 0 0 1 2 3 4 0 0 0]
         "aaaaaaaaaa"
         [-1 0 1 2 3 4 5 6 7 8 9]))
  (testing "matching"
    (are [p x y] (= (all-matches (the-bytes p) (map the-bytes x)) y)
         "" [""] [0]
         "" ["a"] [0 1]
         "" ["a" "b"] [0 1 2]
         "" ["abc"] [0 1 2 3]
         "" ["ab" "" "" "" "" "" "cd" "e"] [0 1 2 3 4 5]
         "a" [""] []
         "a" ["a"] [0]
         "a" ["a" "a" "a" "aaaa"] [0 1 2 3 4 5 6]
         "aa" ["aaaaaaaaaaaaa"] [0 1 2 3 4 5 6 7 8 9 10 11]
         "abc" [""] []
         "abc" ["rogue"] []
         "abc" ["abc"] [0]
         "abc" ["abc"] [0]
         "abc" ["1abc"] [1]
         "abc" ["ababc"] [2]
         "abc" ["ab" ""  "bd" "ab" "c"] [4]
         "abc" ["ab" "ca" "bc" "ab" "ca"] [0 3 6]
         "abc" ["ab" "ca" "bc" "ab" "cabraca" "abacab" "collate"] [0 3 6 19]
         "abc" ["abcabcabc"] [0 3 6])))
