Design: 05.01.01/P03

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 3: Opening and closing multiple workstations

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

numacc = number of accessible workstations (from configuration file)

TEST: #SR 9 10
      "The maximum number of simultaneously open workstations
       returned by <inquire phigs facilities> should be at least 1."

<inquire phigs facilities> to determine
   maxsim = maximum number of simultaneously open workstations
pass/fail depending on (maxsim >=1)

if (maxsim <= numacc) then
   maxct = maxsim
   TEST: #SR 9 11
         "If the maximum number of simultaneously open
          workstations is less than or equal to the number of
          accessible workstations, then it should be possible to
          have that maximum simultaneously open."
else
   maxct = numacc
   TEST: #SR 9 11
         "If the maximum number of simultaneously open
          workstations is greater than the number of accessible
          workstations, then it should be possible to open all
          accessible workstations simultaneously."
endif

*** *** *** *** ***   open workstations  *** *** *** *** ***

openok = true = workstation state value is open
setok  = true = set of open workstations is correct
ident(1 : maxct) = array of workstation identifiers
type (1 : maxct) = array of specific workstation types

do id = 1 to maxct
   <open workstation> id'th wkid in configuration file
   if error then
      fail
      message about error signalled, wkid
      maxct = id - 1 (adjust for failed workstation)
      goto end_open_test
   endif

   <inquire workstation state value> to determine
     wksval = workstation state value
   if (wksval not= WSOP) then
      openok = false
   endif

   idents(id) = wkid
   <inquire workstation connection and type> to determine
      specwt = specific workstation type
   type(id) = specwt

   <inquire set of open workstations> to determine
      setopn = set of open workstations
   if (setopn not= idents(1 : id) then
      setok = false
   endif

loop
pass

end_open_test:

TEST: #SR 3 5
      "If at least 1 workstation is open, the workstation
       state value should be WSOP."
pass/fail depending on (openok)

TEST: #SR 6 7
      "As workstations are opened, the set of open workstations
       should contain the identifiers of the open workstations
       and nothing else."
pass/fail depending on (setok)

TEST: #SR 8
      "Every open workstation should have a unique specific
       workstation type."
do id = 1 to maxct-1
   do id2 = id+1 to maxct
      if (type(id) = type(id2)) then
         fail
         message about type(id) and type(id2)
         goto end_typedif
      endif
   loop
loop
pass

end_typedif:

*** *** *** *** close workstations *** *** *** ***

wsopok = true = workstation state value WSOP is ok
wsclok = true = workstation state value WSCL is ok
setok  = true = set of open workstations is correct

do id = 1 to maxct
   <close workstation> ident(id)
   <inquire workstation state value> to determine
      wksval

   if (id < maxct) then
      if (wksval not= WSOP) then
         wsopok = false
      endif
   else
     if (wksval not= WSCL) then
        wsclok = false
     endif
   endif

   <inquire set of open workstations> to determine
      setopn = set of open workstations
   if (setopn not= idents(id+1 : maxct) then
      setok = false
   endif
loop

**** *** *** *** *** rest of tests go here *** *** *** ***

TEST: #SR 3 5
      "As workstations are closed, if at least one workstation is
       still open, the workstation state value should be WSOP."
pass/fail depending on (wsopok)

TEST: #SR 3 4
      "After the last open workstation is closed, the workstation
       state value should be WSCL."
pass/fail depending on (wsclok)

TEST: #SR 7 12
      "As workstations are closed, the set of open workstations
       should contain the identifiers of the workstations left
       open and nothing else."
pass/fail depending on (setok)

END PROGRAM 3