(include "#.scm")

(check-eqv? (##fx* 11 33)   363)
(check-eqv? (##fx* 11 -11) -121)
(check-eqv? (##fx* 11 -33) -363)
(check-eqv? (##fx* -11 33) -363)

(check-eqv? (##fx*) 1)
(check-eqv? (##fx* 11) 11)
(check-eqv? (##fx* 11 22) 242)
(check-eqv? (##fx* 11 22 33) 7986)
(check-eqv? (##fx* 11 22 33 44) 351384)

(check-eqv? (fx* 11 33)   363)
(check-eqv? (fx* 11 -11) -121)
(check-eqv? (fx* 11 -33) -363)
(check-eqv? (fx* -11 33) -363)

(check-eqv? (fx*) 1)
(check-eqv? (fx* 11) 11)
(check-eqv? (fx* 11 22) 242)
(check-eqv? (fx* 11 22 33) 7986)
(check-eqv? (fx* 11 22 33 44) 351384)

(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##max-fixnum 2)))
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##max-fixnum -2)))
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##min-fixnum 2)))
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##min-fixnum -2)))
(check-eqv? (fx* -1 ##max-fixnum -1) ##max-fixnum)
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* -1 ##min-fixnum -1)))
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##max-fixnum ##max-fixnum)))
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##min-fixnum ##min-fixnum)))
(check-tail-exn fixnum-overflow-exception? (lambda () (fx* ##min-fixnum ##max-fixnum)))

(check-tail-exn type-exception? (lambda () (fx* 0.0)))
(check-tail-exn type-exception? (lambda () (fx* 0.5)))
(check-tail-exn type-exception? (lambda () (fx* 0.5 9)))
(check-tail-exn type-exception? (lambda () (fx* 9 0.5)))
(check-tail-exn type-exception? (lambda () (fx* 0.5 3 9)))
(check-tail-exn type-exception? (lambda () (fx* 3 0.5 9)))
(check-tail-exn type-exception? (lambda () (fx* 3 9 0.5)))
