Design: 02.02.03/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: Set edit mode to INSERT and manipulate element pointer
CHARACTERISTICS: nnnn
OPERATOR SCRIPT: passive test.
DESIGN:
Use <inquire edit mode> throughout to determine:
edmod = edit mode
Use <inquire element pointer> throughout to determine:
ielpos = element position
strid = 35
label1 = 11
label2 = 12
label3 = 13
label4 = 14
label5 = 15
<open structure> with strid
fill structure with elements:
<label> with label1
<label> with label2
<label> with label3
<label> with label4
<label> with label5
TEST: #SR 5 11
"<Inquire edit mode> should return the current edit mode as the
default edit mode INSERT."
<inquire edit mode> to set edmod
pass/fail depending on (edmod = INSERT)
elepos = 2
<set element pointer> to elepos
TEST: #SR 7
"<Set element pointer> should set the element pointer to an absolute
position."
pass/fail depending on (current element position = elepos)
<set element pointer at label> with label5
TEST: #SR 9
"<Set element pointer at label> should position the element
pointer at the next occurrence of a specified label, when
the current element is not that label."
pass/fail depending on (current element position = 5)
elpsof = -3
<offset element pointer> with elpsof
TEST: #SR 8
"<Offset element pointer> should offset the element pointer by a
relative position."
pass/fail depending on (current element position = 2)
<set edit mode> to REPLACE to nullify default
<set edit mode> to INSERT
TEST: #SR 1 11
"<Inquire edit mode> should return the current edit mode as INSERT
after an explicit setting."
<inquire edit mode> to set edmod
pass/fail depending on (edmod = INSERT)
<label> with label4
TEST: #SR 2
"When <set edit mode> is INSERT, new elements should be inserted
after the element pointed to by the element pointer."
pass/fail depending on
(current structure contents = labels 11, 12, 14, 13, 14, 15)
TEST: #SR 4
"When the edit mode is INSERT, the element pointer should be
updated to point to the new element after insertion."
pass/fail depending on (current element position = 3)
elepos = 10
<set element pointer> to elepos
TEST: #SR 7 10
"If <set element pointer> is used to position the element pointer
to a position greater than the last element in the open structure,
the element pointer should point to the last element."
pass/fail depending on (current element position = 6)
elpsof = 1
<offset element pointer> with elpsof
TEST: #SR 8 10
"If <offset element pointer> is used to position the element pointer
to a position greater than the last element in the open structure,
the element pointer should point to the last element."
pass/fail depending on (current element position = 6)
elepos = -3
<set element pointer> to elepos
TEST: #SR 7 10
"If <set element pointer> is used to position the element pointer
to a position less than zero, the element pointer should point
to zero."
pass/fail depending on (current element position = 0)
elpsof = -1
<offset element pointer> with elpsof
TEST: #SR 8 10
"If <offset element pointer> is used to position the element pointer
to a position less than zero, the element pointer should point
to zero."
pass/fail depending on (current element position = 0)
<label> with label5
TEST: #SR 6
"If the element pointer is 0, then the new element should be inserted
immediately before element 1."
pass/fail depending on
(current structure contents = labels 15, 11, 12, 14, 13, 14, 15)
TEST: #SR 6
"After an insertion of an element at the beginning of a structure,
the element pointer should become 1 and point at the new element."
pass/fail depending on (current element position = 1)
<set element pointer at label> with label5
TEST: #SR 9
"If the element pointer is already positioned at a label element,
<set element pointer at label> should position the element pointer
at the next occurence of a specified label element within the open
structure."
pass/fail depending on (current element position = 7)
END PROGRAM 1