Design: 02.01/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: Inquiring about descendant paths
CHARACTERISTICS: nnnn
OPERATOR SCRIPT: passive test.
DESIGN:
Use <open structure> and <execute structure> to set up
the CSS as follows:
101 106 108
/ | \ /
/ | \ 1/
1/ 2| 3\ /
/ | \ /
/ | 107
/ |
102 103
| \ / \\
| \ 1/ \\
1| 2\ / 2\\3
| \/ \\
| 104 105
| | /
| 1| 1/
\ | /
\ | /
\ | /
\ | /
109
The nodes of the graph (101-109) represent structures, and the
labelled edges are references to invoked (lower) structures.
The labels (1-3) represent the element position of the <execute
structure> function within the calling structure. Eg, an element
reference path from 101 to 109 would be: (101, 2), (103, 3),
(105, 1), (109, 0).
*** *** *** *** *** No truncation *** *** *** *** ***
TEST: #SR 1 4 5 6 8
"<Inquire paths to descendants> should retrieve all maximal
descendant paths when path depth is zero."
Use <inquire paths to descendants> with
structure id = 101
path order = TOPFIRST
path depth = zero, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (101,1), (102,1), (109,0) ),
( (101,1), (102,2), (104,1), (109,0) ),
( (101,2), (103,1), (104,1), (109,0) ),
( (101,2), (103,2), (105,1), (109,0) ),
( (101,2), (103,3), (105,1), (109,0) ),
( (101,3), (107,0) )
) then
fail
generate informative message on cause of failure
goto check_topfirst
endif
Use <inquire paths to descendants> with
structure id = 103
path order = BOTTOMFIRST
path depth = zero, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (103,1), (104,1), (109,0) ),
( (103,2), (105,1), (109,0) ),
( (103,3), (105,1), (109,0) )
) then
fail
generate informative message on cause of failure
goto check_topfirst
endif
Use <inquire paths to descendants> with
structure id = 109
path order = BOTTOMFIRST
path depth = zero, to get:
sadp = set of all descendant paths.
if (sadp not empty) then
fail
generate informative message on cause of failure
goto check_topfirst
endif
Use <inquire paths to descendants> with
structure id = 108
path order = TOPFIRST
path depth = zero, to get:
sadp = set of all descendant paths.
if (sadp not empty) then
fail
generate informative message on cause of failure
goto check_topfirst
endif
pass
*** *** *** Truncating via TOPFIRST *** *** ***
check_topfirst:
TEST: #SR 1 4 5 6 11 14
"<Inquire paths to descendants> should retrieve all
qualifying descendant paths (or portions thereof), with no
repetition, when path depth is positive and path order is
TOPFIRST."
Use <inquire paths to descendants> with
structure id = 101
path order = TOPFIRST
path depth = 2, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (101,1), (102,1) ),
( (101,1), (102,2) ),
( (101,2), (103,1) ),
( (101,2), (103,2) ),
( (101,2), (103,3) ),
( (101,3), (107,0) )
) then
fail
generate informative message on cause of failure
goto check_bottomfirst
endif
Use <inquire paths to descendants> with
structure id = 101
path order = TOPFIRST
path depth = 1, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (101,1) ),
( (101,2) ),
( (101,3) )
) then
fail
generate informative message on cause of failure
goto check_bottomfirst
endif
Use <inquire paths to descendants> with
structure id = 104
path order = TOPFIRST
path depth = 5, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (104,1), (109,0) )
) then
fail
generate informative message on cause of failure
goto check_bottomfirst
endif
Use <inquire paths to descendants> with
structure id = 109
path order = TOPFIRST
path depth = 5, to get:
sadp = set of all descendant paths.
if (sadp not empty) then
fail
generate informative message on cause of failure
goto check_bottomfirst
endif
pass
*** *** *** Truncating via BOTTOMFIRST *** *** ***
check_bottomfirst:
TEST: #SR 1 4 5 6 12 14
"<Inquire paths to descendants> should retrieve all
qualifying descendant paths (or portions thereof), with no
repetition, when path depth is positive and path order is
BOTTOMFIRST."
Use <inquire paths to descendants> with
structure id = 101
path order = BOTTOMFIRST
path depth = 2, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (102,1), (109,0) ),
( (104,1), (109,0) ),
( (105,1), (109,0) ),
( (101,3), (107,0) )
) then
fail
generate informative message on cause of failure
goto done
endif
Use <inquire paths to descendants> with
structure id = 102
path order = BOTTOMFIRST
path depth = 1, to get:
sadp = set of all descendant paths.
if (sadp does not contain exactly:
( (109,0) )
) then
fail
generate informative message on cause of failure
goto done
endif
Use <inquire paths to descendants> with
structure id = 108
path order = BOTTOMFIRST
path depth = 1, to get:
sadp = set of all descendant paths.
if (sadp not empty) then
fail
generate informative message on cause of failure
goto done
endif
pass
done:
END PROGRAM 3