Design: 03.03/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: Preservation of structure contents
CHARACTERISTICS: nnnn
OPERATOR SCRIPT: passive test.
DESIGN:
set up values for polymarker and GDP:
xvals = 2.2, 3.3e22, 4.4e-33, -5.5
yvals = -1.2e-22, -2.3e33, -3.4, 0.0
set up parameters for text:
xpos = 9.8, ypos = 7.6
set up parameters for name-set:
nmvals = 2,3,5,8,13,63,0
set up additional parameters for GDP:
numrls = 3 = number of reals to be passed
gdpid = 33
datrec = "1st GDP string","Second string passed to GDP"
struid = 101
<open structure> with struid
<polymarker> with xvals,yvals
<text> with xpos, ypos, "Text string."
<add names to set> with nmvals
<generalized drawing primitive> with
xvals,yvals, gdpid, datrec
<close structure>
find empty archive file, named arnm
arid = 10
<open archive file> with arid,arnm
<archive structures> with arid, struid
<delete structure> with struid
<retrieve structures> with arid, struid
<close archive file> with arid
TEST: #SR 1 4 9 12
"When a structure is archived and retrieved, all the
structure elements and all the parameter values therein
should be accurately restored."
conok = true
for elemno = 1 to 4
msg = "OK"
<inquire element type and size> with struid,elemno
to determine eltype, elsize
if (element doesn't exist) then
conok = false
message about non-existent elemno
goto end_tests
endif
if (eltype incorrect) then
msg = "element type."
goto skip_contents
endif
if (elsize incorrect) then
msg = "element size."
goto skip_contents
endif
<inquire element contents> with struid,elemno
to determine elcont
if (elemno = 1) then
if (elcont not = <polymarker> with xvals,yvals) then
msg = "contents for polymarker."
endif
elseif (elemno = 2) then
if (elcont not = <text> with xpos, ypos, "Text string.") then
msg = "contents for text."
endif
elseif (elemno = 3) then
if (elcont not = <add names to set> with nmvals) then
msg = "contents for add names to set."
endif
elseif (elemno = 4) then
if (elcont not = <generalized drawing primitive> with
xvals,yvals, gdpid, datrec) then
msg = "contents for generalized drawing primitive."
endif
else
abort
endif
skip_contents:
if (msg = "OK") then
do nothing
else
conok = false
informative message: "Incorrect " + msg
endif
next elemno
<inquire element type and size> with struid, elemno = 5
to determine eltype, elsize
if (element exists) then
conok = false
informative message: "Extra element found at end of retrieved structure."
endif
end_tests:
pass/fail depending on (conok)
END PROGRAM 1