          [-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 "matches"
-    (let [m (matcher (the-bytes "abc"))]
-      (are [x y] (= (test-index m x) y)
-           "" nil
-           "rogue" nil
-           "abc" 0
-           "1abc" 1
-           "ababc" 2
-           ["ab" ""  "bd" "ab" "c"] 4)))
-  (testing "all-matches"
+  (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" ["abcabcabc"] [0 3 6]
+         "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]))
-  (testing "matching empty"
-    (let [m (matcher (the-bytes ""))]
-      (are [x y] (= (test-index m x) y)
-           "" 0
-           "rogue" 0
-           "abc" 0
-           "1abc" 0
-           "ababc" 0
-           ["ab" ""  "bd" "ab" "c"] 0)))
-  (testing "matching empty"
-    (are [p x y] (= (all-matches (the-bytes p) (map the-bytes x)) y)
-         "aa" ["aaaaaaaaaaaaa"] [0 1 2 3 4 5 6 7 8 9 10 11]
-         "" ["abc"] [0 1 2 3]
-         "" ["ab" "cdef"] [0 1 2 3 4 5 6])))
+         "abc" ["ab" "ca" "bc" "ab" "cabraca" "abacab" "collate"] [0 3 6 19]
+         "abc" ["abcabcabc"] [0 3 6])))

  (: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]

          (recur matcher byte-arrays (conj matches index))
          (recur matcher (next byte-arrays) matches)))
      matches)))

(deftest a-test
  (testing "border generation"
