Design: 02.02.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: Delete element range

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

strid  = 100
labl1  = 1
labl2  = 2
labl3  = 3
labl4  = 4
labl5  = 5
labl6  = 6
labl7  = 7
labl8  = 8
labl9  = 9
labl10 = 10

<open structure> with strid

fill structure with elements:
<label> with labl1
<label> with labl2
<label> with labl4
<label> with labl3
<label> with labl4
<label> with labl6
<label> with labl5
<label> with labl6
<label> with labl8
<label> with labl7
<label> with labl8
<label> with labl10
<label> with labl9
<label> with labl10
<label> with labl2
<label> with labl1
<label> with labl2
<label> with labl4
<label> with labl3

elpos1 = 9
elpos2 = 11
TEST: #SR 3
      "<Delete element range> should delete all structure
       elements between and including the lower element position
       and the higher element position when the lower position is
       the first parameter."
<delete element range> with elpos1, elpos2
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 6, 5, 6, 10, 9, 10, 2,
                                       1, 2, 4, 3)

elpos1 = 16
elpos2 = 14
TEST: #SR 3
      "<Delete element range> should delete all structure
       elements between and including the lower element position
       and the higher element position when the lower position is
       the second parameter."

<delete element range> with elpos1, elpos2
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 6, 5, 6, 10, 9, 10, 2,
                                       1)

TEST: #SR 7
      "Following <delete element range>, the element pointer
       should be positioned at the element immediately preceding
       the group of elements deleted at the end of the structure."
pass/fail depending on (current element position = 13)

elpos1 = 1
elpos2 = 3
TEST: #SR 3
      "<Delete element range> should delete all structure
       elements between and including the lower element position
       and the higher element position when the lower element
       position is defined as the beginning of the structure."

<delete element range> with elpos1, elpos2
pass/fail depending on
  (current structure content = labels: 3, 4, 6, 5, 6, 10, 9, 10, 2, 1)

TEST: #SR 7
      "Following <delete element range>, the element pointer
       should be positioned at the element immediately preceding
       the group of elements deleted at the beginning of the
       structure."
pass/fail depending on (current element position = 0)

elpos1 = -10
elpos2 = 3
TEST: #SR 3 4
      "If <delete element range> is used, and if an element
       position is less than 1, a value of 0 should be used."

<delete element range> with elpos1, elpos2
pass/fail depending on
   (current structure contents = labels: 5, 6, 10, 9, 10, 2, 1)

TEST: #SR 7
      "Following <delete element range>, the element pointer
       should be positioned at the element immediately preceding
       the group of elements deleted when the element position is
       less than 1."
pass/fail depending on (current element position = 0)

elpos1 = 5
elpos2 = 10
TEST: #SR 3 4
      "If <delete element range> is used, and if an element
       position is greater than the number of elements in the
       open structure, a value pointing to the last element in
       the structure should be used."
<delete element range> with elpos1, elpos2
pass/fail depending on
  (current structure contents = labels: 5, 6, 10, 9)

TEST: #SR 7
      "Following <delete element range>, the element pointer
       should be positioned at the element immediately preceding
       the group of elements deleted when the element position is
       greater than the number of elements in the open structure."
pass/fail depending on (current element position = 4)

elpos1 = -10
elpos2 = 15
TEST: #SR 3 4
      "If <delete element range> is used, and if an element
       position is less than 1, a value of 0 should be used; if
       an element position is greater than the number of elements
       in the open structure, a value pointing to the last
       element in the structure should be used."
<delete element range> with elpos1, elpos2
pass/fail depending on (current structure content = empty)

TEST: #SR 7
      "Following <delete element range>, the element pointer
       should be positioned at the element immediately preceding
       the group of elements deleted when the element positions
       are less than 1 and greater than the number of elements in
       the open structure."
pass/fail depending on (current element position = 0)

END PROGRAM 2