source: project/release/4/suffix-tree/trunk/tests/run.scm @ 30125

Last change on this file since 30125 was 30125, checked in by Ivan Raikov, 7 years ago

suffix-tree: added more examples

File size: 776 bytes
Line 
1(use suffix-tree)
2
3(define t (make-suffix-tree char=? string->list ))
4
5(define t1 (suffix-tree-insert "key1" 'test1 t))
6(define t2 (suffix-tree-insert "key2" 'test2 t1))
7
8(assert (equal? 'test2 (suffix-tree-lookup "key2" t2)))
9(assert (equal? 'test1 (suffix-tree-lookup "key1" t1)))
10
11(define t3 (suffix-tree-lookup/partial  "key" t2))
12
13(assert (equal? 'test1 (suffix-tree-lookup "1" t3)))
14(assert (equal? 'test2 (suffix-tree-lookup "2" t3)))
15
16(define t4 (suffix-tree-insert "to" 'to t))
17(define t5 (suffix-tree-insert "this" 'this t4))
18(define t6 (suffix-tree-insert "the" 'the t5))
19(define t7 (suffix-tree-insert "that" 'that t6))
20
21(define t8 (suffix-tree-lookup/partial  "th" t7))
22(print (suffix-tree-lookup/partial  "e" t8))
23(print (suffix-tree-lookup/partial  "that" t7))
Note: See TracBrowser for help on using the repository browser.