Design: 02.03.02/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: Element search within a single closed structure

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

strid = 40

<polyline 3>, <polymarker 3> parameters:
n = 4
xval = 0.0001, 99.99, -1.3e20, 1.3e13
yval = -99.99, 0.0,   .0015,   5.0
zval = .5e10,  1.2,   -5.0,    0.0

<text 3> parameters:
xpos = 0.0001
ypos = -99.99
zpos = .5e10
xvec = 1.0, .3
yvec = 2.5, -1.6e13
zvec = 0.003, 999.0
chrstr = 'This is a TEXT_3 character string for <element search>.'

<set text font> parameters:
font = -2

<set character height> parameters:
charht = .5

<set individual asf> parameters:
attrid = POLYLINE
asfval = BUNDLED

<execute structure> parameters:
stridx = 30

<label> parameters:
labl1 = 1

<set pick identifier> parameters:
pkid = 5

create structure strid:

<open structure> for strid
fill structure with element types:

POSITION     CONTENTS
--------     --------
   1         <polyline 3>           with n, xval, yval, zval
   2         <polymarker 3>         with n, xval, yval, zval
   3         <text 3>               with xpos, ypos, zpos, xvec, yvec, zvec,
                                         chrstr
   4         <set text font>        with font
   5         <set character height> with charht
   6         <set individual asf>   with attrid, asfval
   7         <execute structure>    with stridx
   8         <label>                with labl1
   9         <set pick identifier>  with pkid
<close structure>

selpos = 0
dir = FORWARD
elinc = EXECUTE_STRUCTURE, LABEL
elexc = POLYLINE_3, POLYMARKER_3, TEXT_3
TEST: #SR 1 2 3 6 8
      "<Element search> should find the next matching element in the
       structure identified when searching FORWARD, and when the
       start element position is at the beginning of the structure."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 7)

selpos = 5
dir = BACKWARD
elinc = TEXT_3, POLYMARKER_3
elexc = SET_TEXT_FONT, SET_CHARACTER_HEIGHT
TEST: #SR 1 2 3 6 8
      "<Element search> should find the next matching element in the
       structure identified when searching BACKWARD, and when the
       start element position is at the middle of the structure."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 3)

selpos = 9
dir = BACKWARD
elinc = SET_TEXT_FONT
elexc = SET_PICK_IDENTIFIER
TEST: #SR 1 2 3 8
      "<Element search> should find the next matching element in
       the structure identified when searching BACKWARD, and when
       the start element position is at the end of the structure."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 4)

selpos = 8
dir = FORWARD
elinc = LABEL, EXECUTE_STRUCTURE, SET_PICK_ID
elexc = NIL
TEST: #SR 1 2 3 4 8
      "<Element search> should find the next matching element in the
       structure identified when searching forward, and when the start
       element position is on the sought element."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 8)

selpos = -5
dir = FORWARD
elinc = POLYLINE_3, POLYMARKER_3
elexc = NIL
TEST: #SR 1 2 3 4 7 8
      "When using <element search>, if the start element position
       is less than 0, the search should begin at element 0."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 1)

selpos = 15
dir = BACKWARD
elinc = SET_PICK_IDENTIFIER, LABEL
elexc = NIL
TEST: #SR 1 2 3 4 7 8
      "When using <element search>, if the start element position
       is greater than the number of elements in the structure,
       the search should begin at the last element in the structure."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 9)

selpos = -5
dir = BACKWARD
elinc = POLYLINE_3, NIL
elexc = TEXT_3
TEST: #SR 1 2 3 5 7 8
      "When using <element search> and searching BACKWARD, if the
       start element position is less than 0 the search should begin
       at element position 0."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 0)

selpos = 15
dir = FORWARD
elinc = SET_PICK_IDENTIFIER, LABEL, POLYLINE_3
elexc = EXECUTE_STRUCTURE
TEST: #SR 1 2 3 7 9
      "When using <element search> and searching FORWARD, if the start
       element position is greater than the number of elements in the
       structure the search should examine only the last element."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 9)

selpos = 0
dir = FORWARD
elinc = ALL
elexc = POLYLINE_3, NIL
TEST: #SR 1 2 3 4 8
      "When using <element search>, the element type ALL in the
       inclusion set should designate all possible element types."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 2)

selpos = 9
dir = BACKWARD
elinc = NIL
elexc = POLYLINE_3
TEST: #SR 1 2 3 4 9
      "When using <element search>, the element type NIL in the
       inclusion set should designate the type of the virtual
       element in position #0."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 0)

selpos = 9
dir = BACKWARD
elinc = empty
elexc = POLYLINE_3
TEST: #SR 1 2 3 6 9
      "When using <element search>, an empty inclusion set should
       designate no element type."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

selpos = 0
dir = FORWARD
elinc = POLYLINE_3, TEXT_3
elexc = ALL
TEST: #SR 1 2 3 4 6 9
      "When using <element search>, the element type ALL in the
       exclusion set should designate all element types."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

selpos = 9
dir = BACKWARD
elinc = ALL
elexc = empty
TEST: #SR 1 2 3 6 8
      "When using <element search>, an empty exclusion set should
       designate no element type."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 9)

selpos = 2
dir = FORWARD
elinc = empty
elexc = empty
TEST: #SR 1 2 3 9
      "When using <element search>, an empty inclusion and exclusion
       set should result in no elements being found."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

selpos = 0
dir = FORWARD
elinc = LABEL
elexc = LABEL
TEST: #SR 1 2 3 9
      "When using <element search>, if an element type is
       specified in both the exclusion set and inclusion set, it
       should be excluded."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

selpos = 1
dir = FORWARD
elinc = NIL
elexc = NIL
TEST: #SR 1 2 3 4 9
      "When using <element search>, if an element type is not
       specified in the exclusion set nor the inclusion set, it
       should be excluded."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

selpos = 0
dir = FORWARD
elinc = POLYLINE_3, TEXT_3, LABEL, SET_PICK_IDENTIFIER
elexc = POLYLINE_3, TEXT_3, EXECUTE_STRUCTURE
TEST: #SR 1 2 3 6 8
      "When using <element search>, an element should qualify for
       selection if and only if its type belongs to the inclusion
       set and does not belong to the exclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 8)

selpos = 0
dir = FORWARD
elinc = SET_TEXT_FONT, POLYLINE_3, ALL
elexc = NIL
TEST: #SR 1 2 3 4 6 8
      "<Element search> should take the union of the element type
       ALL and other element types in the inclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 1)

selpos = 0
dir = FORWARD
elinc = SET_TEXT_FONT, POLYMARKER_3, NIL
elexc = POLYMARKER_3
TEST: #SR 1 2 3 4 6 8
      "<Element search> should take the union of the element type
       NIL and other element types in the inclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 0)

selpos = 9
dir = BACKWARD
elinc = POLYLINE_3, POLYMARKER_3, TEXT_3
elexc = SET_TEXT_FONT, EXECUTE_STRUCTURE, ALL
TEST: #SR 1 2 3 4 6 9
      "<Element search> should take the union of the element type
       ALL and other element types in the exclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

selpos = 9
dir = BACKWARD
elinc = POLYLINE_3, POLYMARKER_3, TEXT_3
elexc = POLYLINE_3, TEXT_3, NIL
TEST: #SR 1 2 3 4 6 8
      "<Element search> should take the union of the element type
       NIL and other element types in the exclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 2)

selpos = 0
dir = FORWARD
elinc = ALL, NIL
elexc = empty
TEST: #SR 1 2 3 4 6 8
      "<Element search> should take the union of the element types
       ALL and NIL in the inclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = SUCCESS and
   felpos = 0)

selpos = 9
dir = BACKWARD
elinc = SET_PICK_IDENTIFIER, LABEL, EXECUTE_STRUCTURE
elexc = ALL, NIL
TEST: #SR 1 2 3 4 6 9
      "<Element search> should take the union of the element types
       ALL and NIL in the exclusion set."

<element search> with strid, selpos, dir, elinc, elexc

pass/fail depending on
  (errind = 0 and
   statid = FAILURE)

END PROGRAM 1