Test output for multi-methods [ok]

Testing time: 0s

'/usr/home/chicken/salmonella/build/salmonella-run-publish/chicken/bin/csi' -script run.scm < /dev/null 2>&1
"ARITY 1"
... passed in (unary?)
(define-multi-method (1+ a))
... passed in (unary?)
"INSERT AT END"
... passed in (unary?)
(multi-method-insert! 1+ (1+-fx? ((a fixnum?)) (fx+ 1 a)))
... passed in (unary?)
(fx= (1+ 5) 6)
... passed in (unary?)
!!! not a fixnum 5.0
(condition-case (= (1+ 5.0) 6.0) ((exn) (print "!!! not a fixnum " 5.0)))
... passed in (unary?)
(multi-method-insert! 1+ (1+-int? ((a integer?)) (+ 1 a)))
... passed in (unary?)
(= (1+ 5.0) 6.0)
... passed in (unary?)
!!! not an integer 5.5
(condition-case (= (1+ 5.5) 6.5) ((exn) (print "!!! not an integer " 5.5)))
... passed in (unary?)
(multi-method-insert! 1+ (1+-num? ((a number?)) (+ 1 a)))
... passed in (unary?)
(= (1+ 5.5) 6.5)
... passed in (unary?)
"INSERT IN THE MIDDLE"
... passed in (unary?)
(multi-method-insert! 1+ (1+-odd? ((a integer? odd?)) (+ 1 a)) 'integer?)
... passed in (unary?)
(multi-method? 1+)
... passed in (unary?)
(not (multi-method? add1))
... passed in (unary?)
(fx= (multi-method-arity 1+) 1)
... passed in (unary?)
(not (multi-method-variadic? 1+))
... passed in (unary?)
(equal? (multi-method-keys 1+) '(fixnum? integer?odd? integer? number?))
... passed in (unary?)
(equal?
  (multi-method-tree 1+)
  '((fixnum? 1+-fx?)
    (integer?odd? 1+-odd?)
    (integer? 1+-int?)
    (number? 1+-num?)))
... passed in (unary?)
"ARITY 2"
... passed in (binary?)
(define-multi-method (add a b))
... passed in (binary?)
(multi-method? add)
... passed in (binary?)
(= (multi-method-arity add) 2)
... passed in (binary?)
(multi-method-empty? add)
... passed in (binary?)
(not (multi-method-variadic? add))
... passed in (binary?)
(multi-method-insert! add (add-num?-num? ((a number?) (b number?)) (+ a b)))
... passed in (binary?)
(multi-method-insert!
  add
  (add-str?-str? ((x string?) (y string?)) (string-append x y)))
... passed in (binary?)
(multi-method-insert!
  add
  (add-fx?-fx? ((a fixnum?) (b fixnum?)) (fx+ a b))
  'number?)
... passed in (binary?)
(multi-method-insert!
  add
  (add-num?-odd? ((a number?) (b integer? odd?)) (+ a b))
  'number?
  'number?)
... passed in (binary?)
(equal? (multi-method-keys add) '(fixnum? number? string?))
... passed in (binary?)
(equal? (multi-method-keys add 'number?) '(integer?odd? number?))
... passed in (binary?)
(equal?
  (multi-method-tree add)
  '((fixnum? ((fixnum? add-fx?-fx?)))
    (number? ((integer?odd? add-num?-odd?) (number? add-num?-num?)))
    (string? ((string? add-str?-str?)))))
... passed in (binary?)
(string=? (add "a" "b") "ab")
... passed in (binary?)
(fx= (add 1 2) 3)
... passed in (binary?)
(= (add 1.5 3.0) 4.5)
... passed in (binary?)
"ARITY 1"
... passed in (variadic?)
(define-multi-method (mult . as))
... passed in (variadic?)
(multi-method? mult)
... passed in (variadic?)
(multi-method-variadic? mult)
... passed in (variadic?)
(multi-method-empty? mult)
... passed in (variadic?)
(multi-method-insert! mult (mult-nums? (as number?) (apply * as)))
... passed in (variadic?)
"VARIADIC ARGUMENTS MUSTN'T BE EMPTY"
... passed in (variadic?)
(multi-method-insert!
  mult
  (mult-fxs?
    (as fixnum?)
    (let loop ((as as) (result 1))
      (if (null? as) result (loop (cdr as) (fx* (car as) result)))))
  'number?)
... passed in (variadic?)
(fx= (mult 1 2 3 4 5) 120)
... passed in (variadic?)
(= (mult 1.0 2.0 3.0 4.0 5.0) 120.0)
... passed in (variadic?)
(= (mult 1.5) 1.5)
... passed in (variadic?)
"ARITY 2"
... passed in (variadic?)
(define-multi-method (add* a . as))
... passed in (variadic?)
(multi-method-variadic? add*)
... passed in (variadic?)
(= (multi-method-arity add*) 2)
... passed in (variadic?)
(multi-method-insert!
  add*
  (add*-str?-strs? ((a string?) : (as string?)) (apply string-append a as)))
... passed in (variadic?)
(multi-method-insert!
  add*
  (add*-fx?-strs?
    ((a fixnum?) : (as string?))
    (apply string-append (->string a) as))
  'string?)
... passed in (variadic?)
(multi-method-insert!
  add*
  (add*-num?-nums? ((a number?) : (as number?)) (apply + a as)))
... passed in (variadic?)
(equal? (multi-method-keys add*) '(fixnum? string? number?))
... passed in (variadic?)
(equal? (multi-method-keys add* 'fixnum?) '(list-of-string?))
... passed in (variadic?)
(equal?
  (multi-method-tree add*)
  '((fixnum? ((list-of-string? add*-fx?-strs?)))
    (string? ((list-of-string? add*-str?-strs?)))
    (number? ((list-of-number? add*-num?-nums?)))))
... passed in (variadic?)
(equal? (multi-method-tree add* 'number?) '((list-of-number? add*-num?-nums?)))
... passed in (variadic?)
(string=? (add* "a" "b" "c") "abc")
... passed in (variadic?)
(string=? (add* 1 "b" "c") "1bc")
... passed in (variadic?)
(= (add* 1.0 2.0 3.0) 6.0)
... passed in (variadic?)
!!! variadic arguments mustn't be empty
(condition-case
  (add* 1.0)
  ((exn) (print "!!! variadic arguments mustn't be empty")))
... passed in (variadic?)

Testing MULTI-METHODS ...
----------------------------
"ARITY 1"
... passed in (unary?)
(define-multi-method (1+ a))
... passed in (unary?)
"INSERT AT END"
... passed in (unary?)
(multi-method-insert! 1+ (1+-fx? ((a fixnum?)) (fx+ 1 a)))
... passed in (unary?)
(fx= (1+ 5) 6)
... passed in (unary?)
!!! not a fixnum 5.0
(condition-case (= (1+ 5.0) 6.0) ((exn) (print "!!! not a fixnum " 5.0)))
... passed in (unary?)
(multi-method-insert! 1+ (1+-int? ((a integer?)) (+ 1 a)))
... passed in (unary?)
(= (1+ 5.0) 6.0)
... passed in (unary?)
!!! not an integer 5.5
(condition-case (= (1+ 5.5) 6.5) ((exn) (print "!!! not an integer " 5.5)))
... passed in (unary?)
(multi-method-insert! 1+ (1+-num? ((a number?)) (+ 1 a)))
... passed in (unary?)
(= (1+ 5.5) 6.5)
... passed in (unary?)
"INSERT IN THE MIDDLE"
... passed in (unary?)
(multi-method-insert! 1+ (1+-odd? ((a integer? odd?)) (+ 1 a)) 'integer?)
... passed in (unary?)
(multi-method? 1+)
... passed in (unary?)
(not (multi-method? add1))
... passed in (unary?)
(fx= (multi-method-arity 1+) 1)
... passed in (unary?)
(not (multi-method-variadic? 1+))
... passed in (unary?)
(equal? (multi-method-keys 1+) '(fixnum? integer?odd? integer? number?))
... passed in (unary?)
(equal?
  (multi-method-tree 1+)
  '((fixnum? 1+-fx?)
    (integer?odd? 1+-odd?)
    (integer? 1+-int?)
    (number? 1+-num?)))
... passed in (unary?)
"ARITY 2"
... passed in (binary?)
(define-multi-method (add a b))
... passed in (binary?)
(multi-method? add)
... passed in (binary?)
(= (multi-method-arity add) 2)
... passed in (binary?)
(multi-method-empty? add)
... passed in (binary?)
(not (multi-method-variadic? add))
... passed in (binary?)
(multi-method-insert! add (add-num?-num? ((a number?) (b number?)) (+ a b)))
... passed in (binary?)
(multi-method-insert!
  add
  (add-str?-str? ((x string?) (y string?)) (string-append x y)))
... passed in (binary?)
(multi-method-insert!
  add
  (add-fx?-fx? ((a fixnum?) (b fixnum?)) (fx+ a b))
  'number?)
... passed in (binary?)
(multi-method-insert!
  add
  (add-num?-odd? ((a number?) (b integer? odd?)) (+ a b))
  'number?
  'number?)
... passed in (binary?)
(equal? (multi-method-keys add) '(fixnum? number? string?))
... passed in (binary?)
(equal? (multi-method-keys add 'number?) '(integer?odd? number?))
... passed in (binary?)
(equal?
  (multi-method-tree add)
  '((fixnum? ((fixnum? add-fx?-fx?)))
    (number? ((integer?odd? add-num?-odd?) (number? add-num?-num?)))
    (string? ((string? add-str?-str?)))))
... passed in (binary?)
(string=? (add "a" "b") "ab")
... passed in (binary?)
(fx= (add 1 2) 3)
... passed in (binary?)
(= (add 1.5 3.0) 4.5)
... passed in (binary?)
"ARITY 1"
... passed in (variadic?)
(define-multi-method (mult . as))
... passed in (variadic?)
(multi-method? mult)
... passed in (variadic?)
(multi-method-variadic? mult)
... passed in (variadic?)
(multi-method-empty? mult)
... passed in (variadic?)
(multi-method-insert! mult (mult-nums? (as number?) (apply * as)))
... passed in (variadic?)
"VARIADIC ARGUMENTS MUSTN'T BE EMPTY"
... passed in (variadic?)
(multi-method-insert!
  mult
  (mult-fxs?
    (as fixnum?)
    (let loop ((as as) (result 1))
      (if (null? as) result (loop (cdr as) (fx* (car as) result)))))
  'number?)
... passed in (variadic?)
(fx= (mult 1 2 3 4 5) 120)
... passed in (variadic?)
(= (mult 1.0 2.0 3.0 4.0 5.0) 120.0)
... passed in (variadic?)
(= (mult 1.5) 1.5)
... passed in (variadic?)
"ARITY 2"
... passed in (variadic?)
(define-multi-method (add* a . as))
... passed in (variadic?)
(multi-method-variadic? add*)
... passed in (variadic?)
(= (multi-method-arity add*) 2)
... passed in (variadic?)
(multi-method-insert!
  add*
  (add*-str?-strs? ((a string?) : (as string?)) (apply string-append a as)))
... passed in (variadic?)
(multi-method-insert!
  add*
  (add*-fx?-strs?
    ((a fixnum?) : (as string?))
    (apply string-append (->string a) as))
  'string?)
... passed in (variadic?)
(multi-method-insert!
  add*
  (add*-num?-nums? ((a number?) : (as number?)) (apply + a as)))
... passed in (variadic?)
(equal? (multi-method-keys add*) '(fixnum? string? number?))
... passed in (variadic?)
(equal? (multi-method-keys add* 'fixnum?) '(list-of-string?))
... passed in (variadic?)
(equal?
  (multi-method-tree add*)
  '((fixnum? ((list-of-string? add*-fx?-strs?)))
    (string? ((list-of-string? add*-str?-strs?)))
    (number? ((list-of-number? add*-num?-nums?)))))
... passed in (variadic?)
(equal? (multi-method-tree add* 'number?) '((list-of-number? add*-num?-nums?)))
... passed in (variadic?)
(string=? (add* "a" "b" "c") "abc")
... passed in (variadic?)
(string=? (add* 1 "b" "c") "1bc")
... passed in (variadic?)
(= (add* 1.0 2.0 3.0) 6.0)
... passed in (variadic?)
!!! variadic arguments mustn't be empty
(condition-case
  (add* 1.0)
  ((exn) (print "!!! variadic arguments mustn't be empty")))
... passed in (variadic?)

Results of MULTI-METHODS
----------------------------
All tests passed