On 12/10/2013 10:27 PM, Marc Feeley wrote:
Moreover, it is important to check that the primitive functions raise exceptions correctly. To give you an idea I have added unit tests for fx+ and fl+. Here's the unit test for fx+:
(check-exn type-exception? (lambda () (fx+ 1/2))) (check-exn type-exception? (lambda () (fx+ 1/2 9))) (check-exn type-exception? (lambda () (fx+ 9 1/2))) (check-exn type-exception? (lambda () (fx+ 1/2 3 9))) (check-exn type-exception? (lambda () (fx+ 3 1/2 9))) (check-exn type-exception? (lambda () (fx+ 3 9 1/2)))
(check-exn fixnum-overflow-exception? (lambda () (fx+ ##max-fixnum 1))) (check-exn fixnum-overflow-exception? (lambda () (fx+ ##min-fixnum -1)))
How would one deal with this situation:
firefly:~/programs/gambit/marc/gambit> gsi Gambit v4.7.1
> (atan +i) *** ERROR IN (console)@1.1 -- (Argument 1) Out of range (atan +i) 1> > (atan -i) *** ERROR IN ##atan -- (Argument 1) Out of range (log 0) 1>
where an "Out of range" exception is raised, but for the wrong function.
Brad