add test and description comment

This commit is contained in:
Sunrim KIM (keen) 2014-08-09 06:32:46 +09:00
parent 54eed63df6
commit d3acad378c
1 changed files with 272 additions and 3 deletions

View File

@ -23,34 +23,303 @@
(test-begin)
(test 0 (history-length))
(test 0 (where-history))
(add-history "1")
(test 1 (history-length))
(test 1 (where-history))
(let loop ((n 2))
(if (>= 10 n)
(begin
(add-history (number->string n))
(loop (+ n 1)))))
#|
index 0 1 2 3 4 5 6 7 8 9
history "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
offset 1 2 3 4 5 6 7 8 9 10
pos 10 9 8 7 6 5 4 3 2 1
p
|#
(test 10 (history-length))
(test 1 (where-history))
(stifle-history 7)
#|
index 0 1 2 3 4 5 6 7 8 9
history "1" "2" "3"|"4" "5" "6" "7" "8" "9" "10"
offset 1 2 3 4 5 6 7 8 9 10
pos 10 9 8 7 6 5 4 3 2 1
p
|#
(test 10 (history-length))
(test 1 (where-history))
(test 0 (history-set-pos 0))
#|
index 0 1 2 3 4 5 6 7 8 9
history "1" "2" "3"|"4" "5" "6" "7" "8" "9" "10"
offset 1 2 3 4 5 6 7 8 9 10
pos 10 9 8 7 6 5 4 3 2 1
p
|#
(test 10 (where-history))
(add-history "11")
#|
index 0 1 2 3 4 5 6
history "5" "6" "7" "8" "9" "10" "11"
offset 5 6 7 8 9 10 11
pos 7 6 5 4 3 2 1
p
|#
(test 7 (history-length))
(test 1 (where-history))
(test #t (history-stifled?))
(unstifle-history)
(test #f (history-stifled?))
(test 7 (history-length))
(test 1 (where-history))
(add-history "12")
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 8 (history-length))
(test 1 (where-history))
(test "12" (current-history))
(test 1 (where-history))
(test #f (previous-history))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
index 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 1 (where-history))
(test "11" (next-history))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 2 (where-history))
(test 0 (history-set-pos 5))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 3 (where-history))
(test -1 (history-set-pos (history-length)))
(test 3 (where-history))
(test -1 (history-set-pos -1))
(test 3 (where-history))
(test 0 (history-set-pos 0))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test (history-length) (where-history))
(test 0 (history-set-pos (- (history-length) 2)))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 2 (where-history))
(test "11" (current-history))
(test 2 (where-history))
(test "12" (previous-history))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 1 (where-history))
(test "11" (next-history))
#|
index 0 1 2 3 4 5 6 7
history "5" "6" "7" "8" "9" "10" "11" "12"
offset 5 6 7 8 9 10 11 12
pos 8 7 6 5 4 3 2 1
p
|#
(test 2 (where-history))
(test "11" (history-get 11))
(remove-history 1)
(test "11" (history-get 11))
(test "6" (remove-history 1))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 6 (where-history))
(test "7" (current-history))
(test "5" (next-history))
(test #f (history-get 6))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 7 (history-length))
(history-set-pos 6)
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 0 (history-search "7" -1))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 6 (where-history))
(history-set-pos 6)
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test -1 (history-search "7" 0))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(history-set-pos 0)
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test -1 (history-search "7" -1))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 7 (where-history))
(history-set-pos 0)
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 0 (history-search "7" 0))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 6 (where-history))
(test 0 (history-search-prefix "1" 0))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 3 (where-history))
(history-set-pos 5)
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 0 (history-search-prefix "1" -1))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 2 (where-history))
(test 0 (history-search-prefix "1" 0))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 2 (where-history))
(test 0 (history-search-prefix "9" -1))
#|
index 0 1 2 3 4 5 6
history "5" "7" "8" "9" "10" "11" "12"
offset 5 7 8 9 10 11 12
pos 7 6 5 4 3 2 1
p
|#
(test 4 (where-history))
(write-history testfile)
(test 7 (history-length))
(clear-history)
#|
index
history
offset
pos
p
|#
(test 0 (history-length))
(test 0 (where-history))
(add-history "f")
#|
index 1
history "f"
offset 1
pos 1
p
|#
(test 1 (history-length))
(test 1 (where-history))
(test "f" (history-get 1))
;(read-history testfile)
(test 7 (history-length))
;#|
;index 0 1 2 3 4 5 6 7
;history "f" "5" "7" "8" "9" "10" "11" "12"
;offset 1 2 3 4 5 6 7 8
;pos 8 7 6 5 4 3 2 1
; p
;|#
(test 8 (history-length))
(clear-history)
(truncate-file testfile 5)
;(read-history testfile)