Design: 02.02.01/P02

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 2: Opening and closing a non-empty existing structure

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

Use <inquire open structure> throughout to determine:
    opstst = open structure status
    strid = structure identifier

Use <inquire structure status> throughout to determine:
    ststin = structure status indicator

Use <inquire element pointer> throughout to determine:
    elepos = element position

strid = 40

<Open structure> with strid

Fill open structure with elements:
<Label>
<Label>

<inquire open structure> to set opstst, rstrid
TEST: #SR 1 5
      "If a non-empty structure is open <inquire open structure> should
       return an OPEN structure status and the structure identifier of
       the open structure."
pass/fail depending on
  (opstst = OPEN and
   rstrid = strid)

<inquire structure status> for strid to set ststin
TEST: #SR 7
      "<Inquire structure status> should return the appropriate structure
       status as NOTEMPTY for a non-empty structure when the structure is
       open."
pass/fail depending on
  (ststin = NOTEMPTY)

<set element pointer> to 1
<close structure>
<open structure>

<inquire element pointer> to set elepos
TEST: #SR 2 8
      "<Inquire element pointer> should return the element pointer
       position as the last element after opening a non-empty structure."
pass/fail depending on
  (elepos = 2)

<close structure>

<inquire structure status> for strid to set ststin
TEST: #SR 7
      "<Inquire structure status> should return the appropriate structure
       status as NOTEMPTY for a non-empty structure when the structure is
       closed."
pass/fail depending on
  (ststin = NOTEMPTY)

END PROGRAM 2