Design: 02.03.03/P04

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 4: Starting path and search ceiling

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

Set up CSS:

              101
             /   \
           1/     \2
           /       \
        102         105:1,3
         |           |
        1|           |2
         |           |
          \         106
           \       /   \
            \    3/     \5
             \   /       \
              103         107:3,4
             /   \
           1/     \2
           /       \
        108         104:2


Numbers 101-108 are structure identifiers.  Numbers on edges are
element positions of 'execute structure' elements.  Numbers
following colons are element positions of primitives to be found
by spatial search.  E.g. starting from 101, the first found path
should be: (101,1), (102,1), (103,2), (104,2).

All ISS done with same search reference point, search distance
(set so as to find all the primitives listed above), no modelling
clipping, and null filter lists.

TEST: #SR 2 4 5 6 9
      "ISS should ignore a primitive at the starting path
       location, and commence the search at the element
       immediately following."

<incremental spatial search> with
   starting path  = (101,2), (105,2), (106,5), (107,3)
   search ceiling = 1
pass/fail depending on (found path = (101,2), (105,2), (106,5), (107,4))

TEST: #SR 2 4 5 6 9
      "ISS should ignore an execute-structure element at the
       starting path location, and commence the search at the
       element immediately following."

<incremental spatial search> with
   starting path  = (101,1)
   search ceiling = 1
pass/fail depending on (found path = (101,2), (105,1))

TEST: #SR 2 4 5 6 7 8 9
      "Repeated incremental spatial search, starting with element
       zero of the root structure, using the found path as the
       next starting path, and a search ceiling of 1, should find
       all qualifying primitives within a network."

sp = (101,0)
sc = 1
expected paths:
  1: (101,1), (102,1), (103,2), (104,2)
  2: (101,2), (105,1)
  3: (101,2), (105,2), (106,3), (103,2), (104,2)
  4: (101,2), (105,2), (106,5), (107,3)
  5: (101,2), (105,2), (106,5), (107,4)
  6: (101,2), (105,3)
  7: empty

for ipath = 1 to 7
   <incremental spatial search> with
      starting path  = sp
      search ceiling = sc
   IF (found path = expected path (ipath)) THEN
      sp = found path
   ELSE
      fail
      goto end_repeat_test
   ENDIF
next ipath
pass

end_repeat_test:

TEST: #SR 2 4 5 6 9
      "ISS should be able to search a sub-network within a
       larger CSS network."

sp = (106,1)
sc = 1
expected paths:
  1: (106,3), (103,2), (104,2)
  2: (106,5), (107,3)
  3: (106,5), (107,4)
  4: empty

for ipath = 1 to 4
   <incremental spatial search> with
      starting path  = sp
      search ceiling = sc
   IF (found path = expected path (ipath)) THEN
      sp = found path
   ELSE
      fail
      goto end_subnet_test
   ENDIF
next ipath
pass

end_subnet_test:

TEST: #SR 2 4 5 6 8 9
      "A search ceiling greater than 1 should limit the search to
       the network of the indicated structure."

sp = (101,2), (105,2), (106,3), (103,1), (108,0)
sc = 4
expected paths:
  1: (101,2), (105,2), (106,3), (103,2), (104,2)
  2: empty

for ipath = 1 to 2
   <incremental spatial search> with
      starting path  = sp
      search ceiling = sc
   IF (found path = expected path (ipath)) THEN
      sp = found path
   ELSE
      fail
      goto end_ceiling_test
   ENDIF
next ipath
pass

end_ceiling_test:

TEST: #SR 2 4 5 6 8 9
      "Any search ceiling up to the end of the starting path
       should be valid."

sp = (101,1), (102,1), (103,2), (104,1)
sc = 4
expected paths:
  1: (101,1), (102,1), (103,2), (104,2)
  2: empty

for ipath = 1 to 2
   <incremental spatial search> with
      starting path  = sp
      search ceiling = sc
   IF (found path = expected path (ipath)) THEN
      sp = found path
   ELSE
      fail
      goto end_max_ceiling_test
   ENDIF
next ipath
pass

end_max_ceiling_test:

END PROGRAM 4