Test output for arrays [ok]

Testing time: 0s

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

Testing ARRAYS-AND-SETS ...
----------------------------
(define arr (make-array number?))
... passed in (arrays?)
(array? arr)
... passed in (arrays?)
(array-null? arr)
... passed in (arrays?)
(not (array? (array-handler arr)))
... passed in (arrays?)
(zero? (array-length arr))
... passed in (arrays?)
(do ((k 0 (fx+ k 1))) ((fx= k 15)) (array-add! k arr))
... passed in (arrays?)
(not (array-null? arr))
... passed in (arrays?)
(= (array-length arr) 15)
... passed in (arrays?)
(= (array-length (array-range 2 10 arr)) 8)
... passed in (arrays?)
(array-equ? = arr (array-iterate number? 15 add1 0))
... passed in (arrays?)
(= (array-item 0 arr) 0)
... passed in (arrays?)
(= (array-item 10 arr) 10)
... passed in (arrays?)
(= (array-item 14 arr) 14)
... passed in (arrays?)
(equal? (array->list (array-range 5 10 arr)) '(5 6 7 8 9))
... passed in (arrays?)
(equal? (array->vector (array-take 5 arr)) '#(0 1 2 3 4))
... passed in (arrays?)
(array-eqv? (array-copy (array-drop 10 arr)) (array number? 10 11 12 13 14))
... passed in (arrays?)
(array-eq? (array-repeat 5 #f) (array #f #f #f #f #f))
... passed in (arrays?)
(array-eqv? (array-iterate-while (cut < <> 5) add1 0) (array-iterate 5 add1 0))
... passed in (arrays?)
(array-eqv?
  (array-iterate-until (cut = <> 5) add1 0)
  (list->array '(0 1 2 3 4)))
... passed in (arrays?)
(array-eqv? (array-copy (array-range 5 10 arr)) (array number? 5 6 7 8 9))
... passed in (arrays?)
(equal? (array->vector (array-map add1 (array-range 3 6 arr))) '#(4 5 6))
... passed in (arrays?)
(array-eqv?
  (array-map number? + (array number? 1 2) (array number? 10 20 30))
  (array number? 11 22))
... passed in (arrays?)
(array-eqv?
  (array-append
    (array-range 2 5 arr)
    (array-range 10 12 arr)
    (array-range 13 14 arr))
  (array number? 2 3 4 10 11 13))
... passed in (arrays?)
(define copied (array-copy arr))
... passed in (arrays?)
(array-reverse! copied)
... passed in (arrays?)
(array-eqv? copied (array number? 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
... passed in (arrays?)
(array-eqv? copied (array-reverse arr))
... passed in (arrays?)
(array-cursor-start! arr)
... passed in (arrays?)
(array-cursor-goto! (cut = <> 5) arr)
... passed in (arrays?)
(= (array-cursor-item arr) 5)
... passed in (arrays?)
(array-cursor-goto! (cut = <> 5) arr)
... passed in (arrays?)
(array-cursor-finished? arr)
... passed in (arrays?)
(array-reverse! copied)
... passed in (arrays?)
(= (let ((arr-5-10 (array-range 5 10 copied)))
     (array-cursor-start! arr-5-10)
     (array-cursor-next! arr-5-10)
     (array-cursor-item arr-5-10))
   5)
... passed in (arrays?)
(array-prune! arr)
... passed in (arrays?)
(array-eqv? arr (array-take 14 copied))
... passed in (arrays?)
(array-add! 14 arr)
... passed in (arrays?)
(array-eqv? arr copied)
... passed in (arrays?)
(define arr0 (array 0))
... passed in (arrays?)
(array-prune! arr0)
... passed in (arrays?)
(array-null? arr0)
... passed in (arrays?)
(define arr1 (make-array number?))
... passed in (arrays?)
(do ((k 15 (fx+ k 1))) ((fx= k 20)) (array-add! k arr1))
... passed in (arrays?)
(array-append! arr1 (array number? 20 21) (array number? 22))
... passed in (arrays?)
(array-eqv? arr1 (array-iterate number? 8 add1 15))
... passed in (arrays?)
(equal?
  (receive
    (ar0 ar1)
    (array-filter odd? arr)
    (list (array->vector ar0) (array->vector ar1)))
  '(#(1 3 5 7 9 11 13) #(0 2 4 6 8 10 12 14)))
... passed in (arrays?)
(array-eqv? (array-range 3 8 arr) (array-iterate number? 5 add1 3))
... passed in (arrays?)
(equal?
  (receive
    (ar0 ar1)
    (array-split-with (cut <= <> 5) arr)
    (list (array->list ar0) (array->list ar1)))
  '((0 1 2 3 4 5) (6 7 8 9 10 11 12 13 14)))
... passed in (arrays?)
(array-eqv? (array-take-while (cut <= <> 5) arr) (array number? 0 1 2 3 4 5))
... passed in (arrays?)
(array-eqv?
  (array-drop-while (cut <= <> 5) arr)
  (array number? 6 7 8 9 10 11 12 13 14))
... passed in (arrays?)
(= (array-fold-left * 1 arr1) (* 15 16 17 18 19 20 21 22))
... passed in (arrays?)
(equal?
  (array-fold-left cons '() (array-take 5 arr1))
  '(((((() . 15) . 16) . 17) . 18) . 19))
... passed in (arrays?)
(equal? (array-fold-right cons '() arr1) '(15 16 17 18 19 20 21 22))
... passed in (arrays?)
(= (array-fold-left + 0 (array 1 2 3) (array 10 20 30)) 66)
... passed in (arrays?)
(array-eqv? (array-reverse arr) (array-iterate number? 15 sub1 14))
... passed in (arrays?)
(array-eqv?
  (array-reverse (array-range 5 10 arr))
  (array-iterate number? 5 sub1 9))
... passed in (arrays?)
(array-sorted? < arr)
... passed in (arrays?)
(not (array-sorted? < (array 1 3 2 4 5 7)))
... passed in (arrays?)
(define rar (make-array number?))
... passed in (arrays?)
(do ((n 0 (fx+ n 1))) ((fx= n 100)) (array-add! (random 1000) rar))
... passed in (arrays?)
(array-sort! < rar)
... passed in (arrays?)
(array-sorted? <= rar)
... passed in (arrays?)
"note that (array-sorted? < rar) is probably wrong because of dups"
... passed in (arrays?)
(= (array-apply + 1 2 (array number? 3 4 5)) 15)
... passed in (arrays?)
(equal?
  (array-bind (a b . xs) arr (list a b (array->vector xs)))
  (list 0 1 (vector 2 3 4 5 6 7 8 9 10 11 12 13 14)))
... passed in (arrays?)
(array-eqv?
  (array-mappend
    (lambda x (apply array number? x))
    (array number? 1 2)
    (array number? 10 20 30))
  (array number? 1 10 2 20))
... passed in (arrays?)
(array-eqv?
  (array-mappend (lambda x (apply array x)) (array 0 2 4) (array 1 3 5 7 9))
  (array 0 1 2 3 4 5))
... passed in (arrays?)
(array-eqv?
  (array-zip (array 0 2 4) (array 1 3 5 7 9))
  (array 0 1 2 3 4 5 7 9))
... passed in (arrays?)
(equal?
  (receive
    (ar0 ar1)
    (array-unzip arr)
    (list (array->list ar0) (array->list ar1)))
  '((0 2 4 6 8 10 12 14) (1 3 5 7 9 11 13)))
... passed in (arrays?)
(array-eqv? (array 1 2 3) (array 1 2 3) (array 1 2 3))
... passed in (arrays?)
(not (array-eqv? (array 1 2 3) (array 1 2 3 4)))
... passed in (arrays?)
"different item types:"
... passed in (arrays?)
(not (array-eqv? (array number? 1 2 3) (array 1 2 3)))
... passed in (arrays?)
(array-eqv?
  (array-interpose 100 (array-range 5 10 arr))
  (array number? 5 100 6 100 7 100 8 100 9))
... passed in (arrays?)
(array-every? odd? (array 1 5 7))
... passed in (arrays?)
(not (array-every? odd? (array 1 4 7)))
... passed in (arrays?)
(array-some? odd? (array 2 3 5))
... passed in (arrays?)
(not (array-some? odd? (array 2 4 6)))
... passed in (arrays?)
(array-cursor-start! arr)
... passed in (arrays?)
(array-cursor-goto! (cut = <> 5) arr)
... passed in (arrays?)
(= (array-cursor-item arr) 5)
... passed in (arrays?)
(array-eqv? (array-memv 10 arr) (array number? 10 11 12 13 14))
... passed in (arrays?)
(not (array-memv 20 arr))
... passed in (arrays?)
(array-in? = (array 2 3) (array 1 2 3))
... passed in (arrays?)
(not (array-in? = (array 1 2 3) (array 2 3)))
... passed in (arrays?)
(not (array-in? = (array 1 2 3) (array 2 1 3)))
... passed in (arrays?)
(array-equ? = (array-range 5 10 arr) (array number? 5 6 7 8 9))
... passed in (arrays?)
(array-eqv?
  (array-remv 5 arr)
  (array number? 0 1 2 3 4 6 7 8 9 10 11 12 13 14))
... passed in (arrays?)
(array-eqv? (array-take-while even? arr) (array number? 0))
... passed in (arrays?)
(array-eqv?
  (array-drop-while even? arr)
  (array number? 1 2 3 4 5 6 7 8 9 10 11 12 13 14))
... passed in (arrays?)
(array-eqv? (array-filter even? arr) (array number? 0 2 4 6 8 10 12 14))
... passed in (arrays?)
(array-eqv? (array-remove-dups = (array 1 2 1 3 2 4 3 5)) (array 1 2 3 4 5))
... passed in (arrays?)
(define st (make-set =))
... passed in (sets?)
(set? st)
... passed in (sets?)
(set-null? st)
... passed in (sets?)
(not (set-in 5 st))
... passed in (sets?)
(set-add! 5 st)
... passed in (sets?)
(set-in 5 st)
... passed in (sets?)
(set-add! 2 st)
... passed in (sets?)
(= (set-count st) 2)
... passed in (sets?)
(set-in 2 st)
... passed in (sets?)
(set-add! 2 st)
... passed in (sets?)
(= (set-count st) 2)
... passed in (sets?)
(equal? (set->vector st) '#(5 2))
... passed in (sets?)
(equal? (set->list st) '(5 2))
... passed in (sets?)
(do ((k 0 (+ k 1))) ((= k 5) st) (set-add! k st))
... passed in (sets?)
(set-in 3 st)
... passed in (sets?)
(set-remove! 5 st)
... passed in (sets?)
(set= st (set = 0 1 2 3 4))
... passed in (sets?)
(set-remove! 10 st)
... passed in (sets?)
(set= st (set = 0 1 2 3 4))
... passed in (sets?)
(set= (set-iterate = 10 add1 0) (set = 0 1 2 3 4 5 6 7 8 9))
... passed in (sets?)
(set= (set-iterate-while = (cut < <> 10) add1 0) (set = 0 1 2 3 4 5 6 7 8 9))
... passed in (sets?)
(set= (set-iterate-until = (cut = <> 10) add1 0) (set = 0 1 2 3 4 5 6 7 8 9))
... passed in (sets?)
(list->set = '(0 1 2 3 4))
... passed in (sets?)
(vector->set '#(0 1 2 3 4))
... passed in (sets?)
(set<= (set 1 3 2) (set 0 1 2 3 4))
... passed in (sets?)
(not (set<= (set = 1 3 2) (set 0 1 2 3 4)))
... passed in (sets?)
(not (set<= (set 1 3 2 5) (set 0 1 2 3 4)))
... passed in (sets?)
(set= (set 1 3 2 1 2) (set 1 2 3))
... passed in (sets?)
(set= (set-filter odd? (set 0 1 2 3 4 5 6)) (set 1 3 5))
... passed in (sets?)
(set= (set-map + (set 1 2 3 4) (set 10 20 30)) (set 11 22 33))
... passed in (sets?)
(set= (set-copy (set 1 2 3 2 1 2)) (set 1 2 3))
... passed in (sets?)
(set= (set-difference (set 1 2 3 2 1 2) (set 1 5 6 2)) (set 3))
... passed in (sets?)
(set= (set-union (set 1 3 2 1) (set 10 20 10) (set 200 100 200 300))
      (set 1 2 3 10 20 100 200 300))
... passed in (sets?)
(set= (set-intersection (set 0 1 2 3 4 5) (set 7 9 1 3 5)) (set 1 3 5))
... passed in (sets?)
(set= (set-intersection (set 0 1 2 3 4 5) (set 7 9 1 3 5) (set 1 3)) (set 1 3))
... passed in (sets?)
(set-every? odd? (set 1 3 5 7))
... passed in (sets?)
(set-every? odd? (make-set))
... passed in (sets?)
(not (set-every? odd? (set 1 3 5 4 7)))
... passed in (sets?)
(not (set-some? odd? (make-set)))
... passed in (sets?)
(not (set-some? odd? (set 2 4 6 8 10)))
... passed in (sets?)
(set-some? odd? (set 2 4 6 8 7 10))
... passed in (sets?)
(= (set-apply + 1 2 3 (set 4 5)) 15)
... passed in (sets?)

Results of ARRAYS-AND-SETS
----------------------------
All tests passed