Design: 02.02.04/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: Delete elements between labels

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 labl7
<label> with labl8
<label> with labl10
<label> with labl9
<label> with labl10

elepos = 6
TEST: #SR 5 6
      "<Delete elements between labels> should delete elements
       between but not including the occurrences of two specified
       labels when the element pointer is not pointing to a
       specified label."
<set element pointer> to elepos
<delete elements between labels> with labl5, labl8
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 6, 5, 8, 7, 7, 8,
                                       10, 9, 10)
TEST: #SR 7
      "Following <delete elements between labels>, the element
       pointer should be positioned at the element immediately
       preceding the deleted group elements (when the element
       pointer was not pointing to a specified label)."
pass/fail depending on (current element position = 7)

elepos = 3
TEST: #SR 5 6
      "<Delete elements between labels> should delete elements
       between but not including the occurrences of two specified
       labels when the element pointer is currently pointing to a
       specified label."
<set element pointer> to elepos
<delete elements between labels> with labl4, labl5
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 5, 8, 7, 7, 8,
                                       10, 9, 10)

TEST: #SR 7
      "Following <delete elements between labels>, the element
       pointer should be positioned at the element immediately
       preceding the deleted group elements (when the element
       pointer was pointing to a specified label)."
pass/fail depending on (current element position = 5)

elepos = 1
TEST: #SR 5 6
      "<Delete elements between labels> should delete elements between
       but not including the successive occurrences of two labels with
       the same value."
<set element pointer> to elepos
<delete elements between labels> with labl8, labl8
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 5, 8, 8, 10, 9, 10)

TEST: #SR 7
      "Following <delete elements between labels>, the element
       pointer should be positioned at the element immediately
       preceding the deleted group elements (when both labels
       had the same value)."
pass/fail depending on (current element position = 7)

elepos = 0
TEST: #SR 5 6
      "<Delete elements between labels> should delete no elements
       if the two labels are adjacent."
<set element pointer> to elepos
<delete elements between labels> with labl4, labl3
pass/fail depending on
  (current structure content = labels: 1, 2, 4, 3, 4, 5, 8, 8, 10, 9, 10)

TEST: #SR 7
      "Following <delete elements between labels>, the element
       pointer should be positioned at the element immediately
       preceding the deleted group elements (when the labels
       were adjacent)."
pass/fail depending on (current element position = 3)

END PROGRAM 3