Sha256: bc3570acbc81a324f06911f7b1fe71669138a4c4b6015b0df28dd0472f74dde9

Contents?: true

Size: 1.06 KB

Versions: 53

Compression:

Stored size: 1.06 KB

Contents

(ql:quickload "lisp-unit")

#-xlisp-test (load "hamming")

(defpackage #:hamming-test
  (:use #:common-lisp #:lisp-unit))

(in-package #:hamming-test)

(define-test no-difference-between-empty-strands
  (assert-equal 0 (hamming:distance "" "")))

(define-test no-difference-between-identical-strands
  (assert-equal 0 (hamming:distance "GGACTGA" "GGACTGA")))

(define-test complete-hamming-distance-in-small-strand
  (assert-equal 3 (hamming:distance "ACT" "GGA")))

(define-test small-hamming-distance-in-middle-somewhere
  (assert-equal 1 (hamming:distance "GGACG" "GGTCG")))

(define-test larger-distance
  (assert-equal 2 (hamming:distance "ACCAGGG" "ACTATGG")))

(define-test invalid-to-get-distance-for-different-length-strings
  (assert-equal nil (hamming:distance "AGACAACAGCCAGCCGCCGGATT" "AGGCAA"))
  (assert-equal nil (hamming:distance "AGACAACAGCCAGCCGCCGGATT" "AGACATCTTTCAGCCGCCGGATTAGGCAA"))
  (assert-equal nil (hamming:distance "AGG" "AGACAACAGCCAGCCGCCGGATT")))

#-xlisp-test
(let ((*print-errors* t)
      (*print-failures* t))
  (run-tests :all :hamming-test))

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
trackler-2.0.5.16 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.15 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.14 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.13 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.12 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.11 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.10 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.9 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.8 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.7 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.6 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.5 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.4 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.3 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.2 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.1 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.5.0 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.4.0 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.3.9 tracks/lisp/exercises/hamming/hamming-test.lisp
trackler-2.0.3.8 tracks/lisp/exercises/hamming/hamming-test.lisp