Design: 03.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: Effect of <open archive file> and <close archive file>

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

Throughout, use variable names:
arid   : archive file identifier
arnm   : archive file name
mxarno : maximum number of simultaneously open archive files
arstat : archive file state
openok : <open archive file> ok flag
closok : <close archive file> ok flag
statok : archive state ok flag
arset  : open archive file set ok flag
accok  : access archive file ok flag
acidls : actual open archive file id. list
acnmls : actual open archive file name list
exidls : expected open archive file id. list
exnmls : expected open archive file name list
arcnum : opened archive file counter
struid : structure identifier
custid : structure identifier list in CSS

TEST: #SR 10
      "Before opening PHIGS, <inquire archive state value> should
       return the archive state as ARCL."
<Inquire archive state value> to determine
   arstat = archive file state
pass/fail depending on (arstat = ARCL)

<open phigs>

TEST: #SR 3 10
      "Immediately after <open phigs>, the archive state should
       be reported as ARCL."
<Inquire archive state value> to determine
   arstat = archive file state
pass/fail depending on (arstat = ARCL)

TEST: #SR 4 11
      "Immediately after <open phigs>, the set of open archive files
       should be reported as empty."
<Inquire archive files> to determine acidls
pass/fail depending on (acidls is empty)

TEST: #SR 1 2
      "<Inquire phigs facilities> should report the maximum
       number of simultaneously open archive files to be greater
       than 0."
<Inquire phigs facilities> to determine
      mxarno = maximum number of simultaneously open archive files
if (<Inquire phigs facilities> successfully reports mxarno > 0) then
   pass
else
   fail
   informative message about failure, skipping opening/closing tests
   goto check_close
endif

openok = TRUE
statok = TRUE
arset  = TRUE
accok  = TRUE
do arcnum from 1 to mxarno step 1
   <open archive file> with:
      arid = arcnum + 10
      arnm = name of a new archive file
   if error signalled on open
      informative message about failure to open arnm
      openok = FALSE
      goto end_open_loop
   endif
   <inquire archive state value> to determine
      arstat = archive file state
   if (arstat not= AROP)
      statok = FALSE
   endif
   exidls (arcnum) = arid
   exnmls (arcnum) = arnm
   <Inquire archive files> to determine:
      acidls = actual open archive file id. list
      adnmls = actual open archive file name list
   if (exidls(1:arcnum) and acidls contain different identifiers)
      arset = FALSE
   endif
   if (exnmls(1:arcnum) and acnmls contain different names)
      arset = FALSE
   endif

   empty out both CSS and archive file arid
   <open structure> with struid = arcnum+20
   <label> arcnum+30
   <close structure>

   <archive all structures> with arid
   <delete all structures> (from CSS)
   <retrieve all structures> with arid
   <inquire structure identifiers> to determine:
      custid = current structure identifier list in CSS
   if (custid not= [arcnum+20])
      accok = FALSE
   endif
end_open_loop:
loop

TEST: #SR 1 2
      "Opening the maximum number of simultaneously open archive
       files should be allowed."
pass/fail depending on (openok)

TEST: #SR 5 10
      "A successful <open archive file> should set the archive state
       to AROP."
pass/fail depending on (statok)

TEST: #SR 6 11
      "A successful <open archive file> should add the specified file
       to the set of open archive files."
pass/fail depending on (arset)

TEST: #SR 7
      "A successful <open archive file> should provide access to the
       archive file of the specified name through the specified
       identifier."
pass/fail depending on (accok)

closok = TRUE
statok = TRUE
arset  = TRUE
do arcnum from mxarno to 1 step -1
   <close archive file> with:
      arid = arcnum + 10
   if error signalled on close
      informative message about failure to close arid
      closok = FALSE
   endif
   <Inquire archive state value> to determine
      arstat = archive state value
   if (arcnum = 1) then
      if (arstat NOT = ARCL)
         statok = FALSE
      endif
   else
      if (arstat NOT = AROP)
         statok = FALSE
      endif
   endif
   <Inquire archive files> to determine:
      acidls = actual open archive file id. list
      adnmls = actual open archive file name list
   if (exidls (1 : arcnum-1) and acidls contain different identifiers)
      arset = FALSE
   endif
   if (exnmls (1 : arcnum-1) and acnmls contain different names)
      arset = FALSE
   endif
loop

TEST: #SR 8 10
      "A successful <close archive file> on the last open archive
       file should set the archive state to ARCL, but otherwise
       leave the state as AROP."
pass/fail depending on (statok)

TEST: #SR 9
      "Closing an archive file in the set of open archive files
       should succeed."
pass/fail depending on (closok)

TEST: #SR 9 11
      "A successful <close archive file> should remove the
       specified file from the set of open archive files."
pass/fail depending on (arset)

check_close:
<close phigs>

TEST: #SR 10
      "After closing PHIGS, <inquire archive state value> should
       return the archive state as ARCL."
<Inquire archive state value> to determine
   arstat = archive file state
pass/fail depending on (arstat = ARCL)

<open phigs>

TEST: #SR 3 10
      "After closing and re-opening PHIGS, the archive state should
       be reported as ARCL."
<Inquire archive state value> to determine
      arstat = archive file state
pass/fail depending on (arstat = ARCL)

TEST: #SR 4 11
      "After closing and re-opening PHIGS, the set of open
       archive files should be reported as empty."
<Inquire archive files> to determine acidls
pass/fail depending on (acidls is empty)

<close phigs>

END PROGRAM 1