-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcs-test.ss
55 lines (45 loc) · 1.92 KB
/
lcs-test.ss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#lang scheme/base
(require "lcs.ss"
"matrix.ss"
"test-base.ss")
; Tests ------------------------------------------
(define lcs-tests
(test-suite "Tests for lcs.ss"
(test-case "make-lcs-matrix"
(let ([matrix (make-lcs-matrix (list->vector (string->list "7777777"))
(list->vector (string->list "88888888")))])
(check = (matrix-x matrix) 8)
(check = (matrix-y matrix) 9)))
(test-equal? "lcs-length"
(lcs-length (list->vector (string->list "XMJYAUZ"))
(list->vector (string->list "MZJAWXU")))
4)
(test-equal? "lcs-backtrace"
(lcs-backtrace (list->vector (string->list "XMJYAUZ"))
(list->vector (string->list "MZJAWXU")))
(string->list "MJAU"))
(test-equal? "lcs-backtrace-all"
(lcs-backtrace-all (list->vector (string->list "XMJYAUZ"))
(list->vector (string->list "MZJAWXU")))
(list (string->list "MJAU")))
(test-equal? "lcs-diff"
(lcs-diff (list->vector (string->list "abcdfghjqz"))
(list->vector (string->list "abcdefgijkrxyz")))
(list (make-diff 1 diff-op:noop #\a)
(make-diff 1 diff-op:noop #\b)
(make-diff 1 diff-op:noop #\c)
(make-diff 1 diff-op:noop #\d)
(make-diff 1 diff-op:insert #\e)
(make-diff 1 diff-op:noop #\f)
(make-diff 1 diff-op:noop #\g)
(make-diff 1 diff-op:delete #\h)
(make-diff 1 diff-op:insert #\i)
(make-diff 1 diff-op:noop #\j)
(make-diff 1 diff-op:delete #\q)
(make-diff 1 diff-op:insert #\k)
(make-diff 1 diff-op:insert #\r)
(make-diff 1 diff-op:insert #\x)
(make-diff 1 diff-op:insert #\y)
(make-diff 1 diff-op:noop #\z)))))
; Provides ---------------------------------------
(provide lcs-tests)