Design: 02.02.04/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: Delete element

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

elepos = 0
TEST: #SR 2
      "If <delete element> is used, and if the element position
       is zero nothing should be deleted."

<set element pointer> to elepos
<delete element>
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 6, 5, 6, 8, 7, 8,
                                       10, 9, 10)

TEST: #SR 7
      "If <delete element> is used, and nothing is deleted the element
       pointer should be unchanged."
pass/fail depending on (current element position  = 0)

elepos = 1
TEST: #SR 1
      "<Delete element> should delete a leading structure element
       pointed to by the element pointer."

<set element pointer> to elepos
<delete element>
pass/fail depending on
  (current structure content = labels: 2, 4, 3, 4, 6, 5, 6, 8, 7, 8, 10, 9,
                                       10)

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

elepos = 3
TEST: #SR 1
      "<Delete element> should delete a middle structure element
       pointed to by the element pointer."

<set element pointer> to elepos
<delete element>
pass/fail depending on
  (current structure content = labels: 2, 4, 4, 6, 5, 6, 8, 7, 8, 10, 9, 10)

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

elepos = 12
TEST: #SR 1
      "<Delete element> should delete a last structure element
       pointed to by the element pointer."

<set element pointer> to elepos
<delete element>
pass/fail depending on
  (current structure content = labels: 2, 4, 4, 6, 5, 6, 8, 7, 8, 10, 9)

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

END PROGRAM 1