Test output for skiplists [ok]

Testing time: 1s

'/usr/home/chicken/salmonella/build/salmonella-run-publish/chicken/bin/csi' -script run.scm < /dev/null 2>&1

Testing SKIPLISTS ...
----------------------------
"SOME CONSTRUCTORS"
... passed in (skiplist-test)
'(define sls2 (skiplist 4 20 fixnum? - dups))
... passed in (skiplist-test)
(fx= (sl-width sls2) 4)
... passed in (skiplist-test)
(fx= (sl-max-height sls2) 20)
... passed in (skiplist-test)
(sl-dups? sls2)
... passed in (skiplist-test)
'(define sls1 (skiplist 15 fixnum? -))
... passed in (skiplist-test)
(fx= (sl-width sls1) 2)
... passed in (skiplist-test)
(fx= (sl-max-height sls1) 15)
... passed in (skiplist-test)
(not (sl-dups? sls1))
... passed in (skiplist-test)
"A NUMERICAL SKIPLIST WITHOUT DUPS"
... passed in (skiplist-test)
'(define sls (skiplist integer? -))
... passed in (skiplist-test)
(skiplist? sls)
... passed in (skiplist-test)
(not (skiplist? '(1 2 3)))
... passed in (skiplist-test)
(sl-null? sls)
... passed in (skiplist-test)
(not (sl-dups? sls))
... passed in (skiplist-test)
(eq? (sl-item? sls) integer?)
... passed in (skiplist-test)
(fx= (sl-max-height sls) 10)
... passed in (skiplist-test)
(fx= (sl-width sls) 2)
... passed in (skiplist-test)
"INSERT RANDOM VALUES ..."
... passed in (skiplist-test)
'(define lst
   (let loop ((k 0) (lst '()))
     (if (= k 100) lst (loop (+ k 1) (cons (pseudo-random-integer 100) lst)))))
... passed in (skiplist-test)
(apply sl-insert! sls lst)
... passed in (skiplist-test)
(apply < (skiplist->list sls))
... passed in (skiplist-test)
(<= (sl-count sls) 100)
... passed in (skiplist-test)
"FILTER ..."
... passed in (skiplist-test)
((list-of? even?) (skiplist->list (sl-filter even? sls)))
... passed in (skiplist-test)
"MAP ..."
... passed in (skiplist-test)
(let ((fn (lambda (x) (* 2 x))))
  (equal? (map fn (skiplist->list sls)) (skiplist->list (sl-map fn sls))))
... passed in (skiplist-test)
"INSERT AT BOTH ENDS ..."
... passed in (skiplist-test)
(sl-insert! sls -1 100)
... passed in (skiplist-test)
(equal? (sl-min sls) '(-1))
... passed in (skiplist-test)
(equal? (sl-max sls) '(100))
... passed in (skiplist-test)
(sl-search! sls -1)
... passed in (skiplist-test)
(equal? (sl-found sls) '(-1))
... passed in (skiplist-test)
(sl-search! sls 100)
... passed in (skiplist-test)
(equal? (sl-found sls) '(100))
... passed in (skiplist-test)
"REMOVE AT LEFT END ..."
... passed in (skiplist-test)
(sl-remove! sls -1)
... passed in (skiplist-test)
(null? (sl-found sls))
... passed in (skiplist-test)
(sl-search! sls -1)
... passed in (skiplist-test)
(null? (sl-found sls))
... passed in (skiplist-test)
"INSERT ONE IN THE MIDDLE AND REMOVE IT AGAIN ..."
... passed in (skiplist-test)
(sl-insert! sls 25)
... passed in (skiplist-test)
(sl-search! sls 25)
... passed in (skiplist-test)
(= 25 (car (sl-found sls)))
... passed in (skiplist-test)
(memv 25 (sl-found sls))
... passed in (skiplist-test)
(sl-remove! sls 25)
... passed in (skiplist-test)
"RESTRUCTURE ..."
... passed in (skiplist-test)
(equal? (skiplist->list sls) (skiplist->list (sl-restructure sls 4 15)))
... passed in (skiplist-test)
"REORDER DECREASING WITHOUT DUPS ..."
... passed in (skiplist-test)
(let ((slsr (sl-reorder sls (lambda (x y) (- y x)))))
  (apply > (skiplist->list slsr))
  (equal? (sl-min sls) (sl-max slsr))
  (equal? (sl-max sls) (sl-min slsr)))
... passed in (skiplist-test)
"AND WITH DUPS ..."
... passed in (skiplist-test)
(equal?
  (reverse (skiplist->list (sl-reorder sls - dups)))
  (skiplist->list (sl-reorder sls (lambda (x y) (- y x)) dups)))
... passed in (skiplist-test)
"CLEAR ..."
... passed in (skiplist-test)
(sl-clear! sls)
... passed in (skiplist-test)
(null? (sl-min sls))
... passed in (skiplist-test)
(null? (sl-max sls))
... passed in (skiplist-test)
(sl-null? sls)
... passed in (skiplist-test)
"A SKIPLIST OF INTEGER LISTS WITH PRIMARY AND SECONDARY ORDERS"
... passed in (skiplist-test)
'(define item-type (lambda (x) (and ((list-of? integer?) x) (> (length x) 2))))
... passed in (skiplist-test)
'(define primary-order (lambda (x y) (- (car x) (car y))))
... passed in (skiplist-test)
'(define secondary-order (lambda (x y) (- (cadr x) (cadr y))))
... passed in (skiplist-test)
'(define sls3 (skiplist 3 10 item-type primary-order secondary-order dups))
... passed in (skiplist-test)
'(define lst1
   (let loop ((k 0) (lst '()))
     (if (= k 100) lst (loop (+ k 1) (cons (pseudo-random-integer 10) lst)))))
... passed in (skiplist-test)
'(define lst2
   (let loop ((k 0) (lst '()))
     (if (= k 100) lst (loop (+ k 1) (cons (pseudo-random-integer 10) lst)))))
... passed in (skiplist-test)
'(define lst3
   (let loop ((k 0) (lst '()))
     (if (= k 100) lst (loop (+ k 1) (cons (pseudo-random-integer 100) lst)))))
... passed in (skiplist-test)
(apply sl-insert! sls3 (map (lambda (x y z) (list x y z)) lst1 lst2 lst3))
... passed in (skiplist-test)
(sl-dups? sls3)
... passed in (skiplist-test)
(= (sl-count sls3) 100)
... passed in (skiplist-test)
(= (sl-width sls3) 3)
... passed in (skiplist-test)
"INSERTING ITEM AND REMOVING ALL WITH SAME KEY ..."
... passed in (skiplist-test)
((sl-item? sls3) '(1 2 3))
... passed in (skiplist-test)
(sl-search! sls3 '(1 2 3))
... passed in (skiplist-test)
(if (sl-found? sls3 '(1 2 3)) (apply sl-remove! sls3 (sl-found sls3)))
... passed in (skiplist-test)
(sl-insert! sls3 '(1 2 3))
... passed in (skiplist-test)
(sl-search! sls3 '(1 2 3))
... passed in (skiplist-test)
(member '(1 2 3) (sl-found sls3))
... passed in (skiplist-test)
(apply sl-remove! sls3 (sl-found sls3))
... passed in (skiplist-test)
(sl-search! sls3 '(1 2 3))
... passed in (skiplist-test)
(null? (sl-found sls3))
... passed in (skiplist-test)
"PRODUCE DUPLICATES AT THE ENDS ..."
... passed in (skiplist-test)
(sl-insert! sls3 '(-1 2 3) '(-1 2 3 4))
... passed in (skiplist-test)
(equal? (sl-min sls3) '((-1 2 3 4) (-1 2 3)))
... passed in (skiplist-test)
(sl-insert! sls3 '(10 1 2) '(10 1 2 3) '(10 1 3))
... passed in (skiplist-test)
(equal? (sl-found sls3) '((10 1 3) (10 1 2 3) (10 1 2)))
... passed in (skiplist-test)
(equal? (sl-max sls3) '((10 1 3) (10 1 2 3) (10 1 2)))
... passed in (skiplist-test)
"AND REMOVE THEM AGAIN ..."
... passed in (skiplist-test)
(sl-search! sls3 '(-1 2 3 4))
... passed in (skiplist-test)
(apply sl-remove! sls3 (sl-found sls3))
... passed in (skiplist-test)
(sl-search! sls3 '(-1 2 3 4))
... passed in (skiplist-test)
(null? (sl-found sls3))
... passed in (skiplist-test)
(sl-search! sls3 '(10 1 3))
... passed in (skiplist-test)
(apply sl-remove! sls3 (sl-found sls3))
... passed in (skiplist-test)
(null? (sl-found sls3))
... passed in (skiplist-test)
"UNDUP IN THE MIDDLE ..."
... passed in (skiplist-test)
(sl-search! sls3 '(2 3 4))
... passed in (skiplist-test)
(if (not (null? (sl-found sls3))) (apply sl-remove! sls3 (sl-found sls3)))
... passed in (skiplist-test)
(apply sl-insert! sls3 '((2 3 4) (2 3 5) (2 3 6 7)))
... passed in (skiplist-test)
(sl-search! sls3 '(2 3 4))
... passed in (skiplist-test)
(equal? (sl-found sls3) '((2 3 6 7) (2 3 5) (2 3 4)))
... passed in (skiplist-test)
(sl-search! sls3 '(2 3 4))
... passed in (skiplist-test)
(apply sl-remove! sls3 (cdr (sl-found sls3)))
... passed in (skiplist-test)
(sl-search! sls3 '(2 3 4))
... passed in (skiplist-test)
(equal? (sl-found sls3) '((2 3 6 7)))
... passed in (skiplist-test)
"UNDUP AT LEFT END ..."
... passed in (skiplist-test)
(sl-insert! sls3 '(-1 2 3) '(-1 2 3 4))
... passed in (skiplist-test)
(sl-search! sls3 '(-1 2 3))
... passed in (skiplist-test)
(apply sl-remove! sls3 (cdr (sl-found sls3)))
... passed in (skiplist-test)
(sl-search! sls3 '(-1 2 3))
... passed in (skiplist-test)
(equal? (sl-found sls3) '((-1 2 3 4)))
... passed in (skiplist-test)
"UNDUP AT RIGHT END ..."
... passed in (skiplist-test)
(sl-insert! sls3 '(10 1 2) '(10 1 2 3) '(10 1 3))
... passed in (skiplist-test)
(sl-search! sls3 '(10 1 2 3))
... passed in (skiplist-test)
(apply sl-remove! sls3 (cdr (sl-found sls3)))
... passed in (skiplist-test)
(sl-search! sls3 '(10 1 2 3))
... passed in (skiplist-test)
(equal? (sl-found sls3) '((10 1 3)))
... passed in (skiplist-test)
"REORDER REMOVING ALL DUPS ..."
... passed in (skiplist-test)
(apply <=
       (map car
            (skiplist->list (sl-reorder sls3 primary-order secondary-order))))
... passed in (skiplist-test)
(<= (sl-count (sl-reorder sls3 primary-order secondary-order)) (sl-count sls3))
... passed in (skiplist-test)
"REORDER USING ONLY SECONDARY ORDER ..."
... passed in (skiplist-test)
(apply < (map cadr (skiplist->list (sl-reorder sls3 secondary-order))))
... passed in (skiplist-test)
(>= 10 (sl-count (sl-reorder sls3 secondary-order)))
... passed in (skiplist-test)
"FILTER VALUE ..."
... passed in (skiplist-test)
((list-of? odd?)
 (map caddr (skiplist->list (sl-filter (lambda (x) (odd? (caddr x))) sls3))))
... passed in (skiplist-test)

Results of SKIPLISTS
----------------------------
All tests passed