diff --git a/.travis.yml b/.travis.yml index cc01170..b85816a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,14 +19,10 @@ env: - LISP=clisp32 # - LISP=ecl -- This hangs for some reason -matrix: - allow_failures: - - env: "LISP=sbcl COVERALLS=true" - install: - curl -L https://github.com/luismbo/cl-travis/raw/master/install.sh | sh script: - if [[ "$COVERALLS" == "true" ]]; then git clone https://github.com/fukamachi/cl-coveralls ~/lisp/cl-coveralls; fi - - if [[ "$COVERALLS" == "true" ]]; then cl -l edit-distance-test -l edit-distance -l cl-coveralls -e "(coveralls:with-coveralls (:exclude (list \"t\")) $TEST_FORM )"; fi + - if [[ "$COVERALLS" == "true" ]]; then cl -l edit-distance-test -e "(coveralls:with-coveralls (:exclude (list \"t\")) $TEST_FORM )"; fi - if [[ "$COVERALLS" -ne "true" ]]; then cl -l edit-distance-test -l edit-distance -e "$TEST_FORM"; fi diff --git a/README.md b/README.md index d45bd68..ea28ba3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ edit-distance ================= - [![Build Status](https://travis-ci.org/belambert/cl-edit-distance.svg?branch=master) ](https://travis-ci.org/belambert/cl-edit-distance) +[![Coverage Status](https://coveralls.io/repos/github/belambert/cl-edit-distance/badge.svg?branch=coverage) +](https://coveralls.io/github/belambert/cl-edit-distance?branch=coverage) Using ----- diff --git a/edit-distance-test.asd b/edit-distance-test.asd index 62e0414..1d4f7c3 100644 --- a/edit-distance-test.asd +++ b/edit-distance-test.asd @@ -1,8 +1,8 @@ -;;-*- Mode: Lisp -*- +;; -*- Mode: Lisp -*- (asdf:defsystem "edit-distance-test" :name "edit-distance-test" - :description "Computing edit distance" + :description "Computing edit distance between sequences." :version "1.0.0" :author "Ben Lambert " :license "CC-BY-4.0" @@ -12,4 +12,9 @@ :serial t :components ((:file "test")))) - :depends-on ("edit-distance" "lisp-unit")) + :depends-on ("edit-distance" + "lisp-unit" + ;; cl-coverage is failing without these + "trivial-features" + "babel" + "cl-coveralls")) diff --git a/src/test.lisp b/src/test.lisp index 8287602..cb33b55 100644 --- a/src/test.lisp +++ b/src/test.lisp @@ -17,34 +17,31 @@ (in-package :edit-distance-tests) (define-test test-distance-fast - (let ((result (compute-edit-distance '(1 2 3) '(1 2 4)))) - (assert-equal (distance-errors result) 1) - (assert-equal (distance-matches result) 2))) + (let ((result (distance '(1 2 3) '(1 2 4)))) + (assert-equal 1 result))) (define-test test-distance-slow (multiple-value-bind (path distance) - (levenshtein-distance '("1" "2" "3") '("1" "2" "4") :return-path t) + (diff '("1" "2" "3") '("1" "2" "4")) (assert-equal path '((:MATCH "1" "1") (:MATCH "2" "2") (:SUBSTITUTION "3" "4"))) (assert-equal distance 1))) (define-test test-printing (multiple-value-bind (path distance) - (levenshtein-distance '(0 1 2 3) '(1 2 4 5) :return-path t) + (diff '(0 1 2 3) '(1 2 4 5)) (assert-equal distance 3) - (print-differences path))) + (format-diff path))) (define-test test-arrays - (let ((result (compute-edit-distance #(1 2 3) #(1 2 4)))) - (assert-equal (distance-errors result) 1) - (assert-equal (distance-matches result) 2))) + (let ((result (distance #(1 2 3) #(1 2 4)))) + (assert-equal 1 result))) (define-test test-strings - (let ((result (compute-edit-distance "123" "124"))) - (assert-equal (distance-errors result) 1) - (assert-equal (distance-matches result) 2))) + (let ((result (distance "123" "124"))) + (assert-equal 1 result))) (define-test test-string-printing (multiple-value-bind (path distance) - (levenshtein-distance "0123" "1245" :return-path t) + (diff "0123" "1245") (assert-equal distance 3) - (print-differences path))) + (format-diff path)))