fix starts-with-subseq :start1 and :start2
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 26 Jan 2013 13:10:59 +0000 (15:10 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 26 Jan 2013 13:10:59 +0000 (15:10 +0200)
sequences.lisp
tests.lisp

index 8b9a443..94c16b9 100644 (file)
@@ -289,7 +289,7 @@ displaced array pointing to the sequence after PREFIX."
   (let ((sequence-length (length sequence))
         (prefix-length (length prefix)))
     (if (<= prefix-length sequence-length)
-        (let ((mismatch (apply #'mismatch sequence prefix args)))
+        (let ((mismatch (apply #'mismatch prefix sequence args)))
           (if mismatch
               (if (< mismatch prefix-length)
                   (values nil nil)
index 7ffe30f..61579d7 100644 (file)
         (incf n))
       n)
   13)
+
+(deftest starts-with-subseq.start1
+    (starts-with-subseq "foo" "oop" :start1 1)
+  t
+  nil)
+
+(deftest starts-with-subseq.start2
+    (starts-with-subseq "foo" "xfoop" :start2 1)
+  t
+  nil)