Design: 09.01.11.01/P01
This is an abstract, language-independent design. Grim
details may be found in the
corresponding source code.
You may return to the
documentation
for the module containing this program design, or to the
entire hierarchical table of
topics covered by the PVT.
PROGRAM 1: Function of <Set error handler>
CHARACTERISTICS: nnnn
OPERATOR SCRIPT:
This is a passive test, but take care to invoke it so as to link
in the standard PVT user-defined error handler. Since this is
the mode in which the non-error-handling tests are executed, this
program should be invoked in the normal way.
DESIGN:
(1) Design a new error handler "my_err_hand" which saves error code and
function identifier at cur_error, cur_function with initial cur_error=0,
cur_function = 555.
(2) Use user defined "perr_hand" which is used by other test programs and
generates an error. The error information will be stored at common variable
errsav[0], funsav[0].
(3) Use <set error handler> to set a new error handler as "my_err_handler"
and return old error handler. Generate an error using same function with (2).
Compare cur_error with errsav[0], cur_function with funsav[0] to test
if "my_err_hand" is invoked.
(4) Set error handler back to old error handler. Generate an error again.
It should be stored in errsav[1], funsav[1]. Compare errsav[0] with errsav[1],
funsav[0] with funsav[1] to test if <set error handler> returned correct
error handler.
*** *** ***
cur_error=0, cur_function=555
<open phigs>
<text>: signals error
<set error handler> with (my_err_handler, old_err_handler)
<text>: signals error
TEST: #SR 1
"<Set error handler> should set PHIGS error handler to application
defined error handler specified with parameter new error handling
function."
pass/fail depending on (cur_error = errsav[0] and
cur_function = funsav[0])
<set error handler> with (old_err_handler, new_err_handler)
<text>: signals error
TEST: #SR 2
"<set error handler> should return previous error handling subroutine."
pass/fail depending on (errsav[1] = errsav[0] and
funsav[1] = funsav[0])
<close phigs>
END PROGRAM 1