Design: 02.01.02.01/P06

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 6: Effect of <delete structure> on element pointer

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test

DESIGN:

Set up CSS as:

                                100
                                 |
                                 |
  ----------------------------------------------------------------------
  | |       | |       | |       | |       | |       | |       | |      |
  | |       | |       | |       | |       | |       | |       | |      |
2 | | 3   1 | | 6   4 | | 5   7 | | 11  8 | | 12  9 | | 13 10 | | 14   | 15
  | |       | |       | |       | |       | |       | |       | |      |
  101       102       103       104       105       106       107     108

The nodes of the graph (100 and above) represent structures, and
the labelled edges are references to invoke (lower) structures.
The labels (1- 15) represent the element position of the <execute
structure> function within the calling structure.

Structure 100 is left open.

Throughout, expected state is shown as the sequence of
references within structure #100, with the current element
marked by an asterisk.  Thus the first state is:
(102, 101, 101, 103, 103, 102, 104, 105, 106, 107,
 104, 105, 106, 107, 108*)

set edit mode to INSERT
informational message: following tests run in INSERT mode

set element pointer to 5
delete structure #107
TEST: #SR 6
      "When <delete structure> causes deletion of references
       following the current element, the element pointer should be
       unchanged."
pass/fail depending on (current element position = 5)
(102, 101, 101, 103, 103*, 102, 104, 105, 106, 104, 105, 106, 108)

delete structure #101
TEST: #SR 6
      "When <delete structure> causes deletion of references
       preceding the current element, the element pointer should be
       changed so as to point to the same element."
pass/fail depending on (current element position = 3)
(102, 103, 103*, 102, 104, 105, 106, 104, 105, 106, 108)

delete structure #103
TEST: #SR 7
      "When <delete structure> causes deletion of references at the
       current element, the element pointer should be changed so as
       to point to the preceding element."
pass/fail depending on (current element position = 1)
(102*, 102, 104, 105, 106, 104, 105, 106, 108)

delete structure #102
TEST: #SR 7
      "When <delete structure> causes deletion of references at the
       current element, and no preceding element exists, the element
       pointer should be changed to point to zero."
pass/fail depending on (current element position = 0)
(* 104, 105, 106, 104, 105, 106, 108)

set edit mode to REPLACE
informational message: following tests run in REPLACE mode

delete structure #108
TEST: #SR 6
      "When <delete structure> causes deletion of references and
       the element pointer is zero, it should remain at zero."
pass/fail depending on (current element position = 0)
(* 104, 105, 106, 104, 105, 106)

set element pointer to 4
delete structure #105
TEST: #SR 6
      "When <delete structure> causes deletion of references
       surrounding the current element, the element pointer should be
       changed so as to point to the same element."
pass/fail depending on (current element position = 3)
(104, 106, 104*, 106)

set element pointer to 4
delete structure #106
TEST: #SR 7
      "When <delete structure> causes deletion of references at the
       current element, which is the last element, the element
       pointer should be changed so as to point to the preceding
       element."
pass/fail depending on (current element position = 2)
(104, 104*)

delete structure #104
TEST: #SR 7
      "When <delete structure> causes deletion of references at the
       current element thereby emptying the structure, the element
       pointer should be changed to point to zero."
pass/fail depending on (current element position = 0)

END PROGRAM 6