Hi,

I've spent some time on the following problem, and would like to ask for your 
help:

I'm writing a critical piece of an application, and would like to ascertain in 
a "belt and suspenders" kind of way that I get a customized exception if 
something goes wrong.

The approach I have used is based on independent checks (conditionals) that 
might trigger the exception. The problem is that I have not found an elegant 
way to test this code, since there should not be such combinations of 
parameters that could lead to this branch in the conditional. One way would be 
to extract these pieces of code to auxiliary functions and call these from the 
tests with those "impossible" parameters that would trigger the exception. 
However, this would split the code into ugly, detached pieces.

Simplified example:

(let ((a 2)(b 2))
  (if (= (+ a b) 4)
      #t
      (error "impossible!")))

Is there some practical way to access the variable bindings inside a function 
from tests (similarly to the "set! <var>" pop-up menu in the debugger window) 
in order to inject faults to trigger these exceptions?

Best,

Mikko T.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to