Design: 04.02.05.04/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: Setting entries of various kinds

CHARACTERISTICS: ynnn

OPERATOR SCRIPT: passive test.

DESIGN:

if (PATTERN is not in list of available interior styles)then
   message about Pattern not supported on workstation
   goto end_access_all
endif

<inquire workstation state table lengths> to determine maximum
   number of entries:

*** *** *** *** ***    initialized entries   *** *** *** *** ***

<inquire list of pattern indices> to determine initialized entries
   nie = number of initialized entries
   aii = an initialized index
TEST: #SR 3
      "<Inquire list of pattern indices> should return initialized
       indices."
if (<inquire list of pattern indices> indicates error) then
   fail
   goto undefined_test
else
   pass
endif

initialized_test:

<inquire pattern representation> for index# aii, as set
   establishes:
      old_pattern_color_index_array
new_pattern_color_index_array  =
      old_pattern_color_index_array + 1, for each element

<set pattern representation> sets:
  index      = aii
  pattern_color_index_array = new_pattern_color_index_array

<inquire list of pattern indices> returns defined list

TEST: #SR 1 3
      "Redefining a system-initialized entry should not change
       the number of defined entries."
pass/fail depending on (current number of entries = nie)

TEST: #SR 1 3
      "Initialized table entry should be reported as defined after
       being set."
if (defined list includes #aii) then
   pass
else
   fail
   goto undefined_test
endif

<inquire pattern representation> for index# aii, as set
TEST: #SR 2 5
      "New values should be set for initialized table entry."
pass/fail depending on
   (pattern_color_index_array =
      new_pattern_color_index_array)

*** *** *** *** ***    undefined entries   *** *** *** *** ***

undefined_test:

<inquire list of pattern indices> returns defined list
determine lowest undefined index (not in defined list) = lui
determine current number defined entries = cnde

TEST: #SR 3 7
      "<Inquire pattern representation> should return attributes for
       pattern index #1 when inquiring an undefined entry as REALIZED."
<inquire pattern representation> as REALIZED for index #lui
   to get undefined_entry.
<inquire pattern representation> as REALIZED for index #1
   to get pattern index #1.
pass/fail depending on (undefined_entry = entry for pattern index #1).

If (number of initialized entries
   >= max size of pattern table) then
   skip rest of undefined_test; goto redefined_test
endif

If (number of initialized entries
   >= max table size in test program) then
   skip rest of undefined_test; goto redefined_test
endif

<set pattern representation>:
   index     = lui
   pattern_color_index_array = 33 53
                               32 48

<inquire list of pattern indices> to determine
   listot = total number of entries in list

TEST: #SR 1 3
      "Defining an undefined entry should increment the number
       of defined entries."
pass/fail depending on (listot = cnde + 1)

TEST: #SR 1 3
      "Undefined table entry should be reported as defined after set."
if (resulting list of indices contains lui) then
   pass
else
   fail
   goto redefined_test
endif

<inquire pattern representation> for index #lui, as set
TEST: #SR 2 5
      "New values should be set for undefined table entry."
pass/fail depending on
   (pattern_color_index_array =  33 53
                                 32 48)

*** *** *** *** ***    redefined entries   *** *** *** *** ***

redefined_test:

dpi  = defined pattern index
cnde = current number of defined entries

<set pattern representation>:
   index     = dpi
   pattern_color_index_array  =  8 22 36
                                19 53 89

new_pattern_color_index_array =  3  9
                                19 47
<set pattern representation>:
   index = dpi
   pattern_color_index_array =
      new_pattern_color_index_array

<inquire list of pattern indices> to determine
   nnde = new number of defined entries

TEST: #SR 1 3
      "Redefining a user-defined entry should not change number
       of defined entries."
pass/fail depending on (nnde = cnde)

TEST: #SR 1 3
      "Redefined table entry should be reported as defined after
       set."
if (resulting list of indices contains dpi) then
   pass
else
   fail
   goto end_redefined_test
endif

<inquire pattern representation> for index #dpi, as set
TEST: #SR 2 5
      "New values should be set for redefined table entry."
pass/fail depending on
   (pattern_color_index_array = new_pattern_color_index_array)

end_redefined_test:

*** *** *** *** ***    access all defined entries   *** *** *** *** ***

TEST: #SR 3 4
      "<Inquire list of pattern indices> and <inquire pattern
       representation> should detect all defined entries."
Use <inquire list of pattern indices> to get
    list of defined indices
if (non-zero error code) then
   fail
   goto end_access_all
endif
For each defined index, apply <inquire pattern representation>
   if (non-zero error code) then
      fail
      goto end_access_all
   endif
loop to next index
pass

end_access_all:

END PROGRAM 2