Design: 11.02/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: Definition of macros in phigs.h

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

This program exploits the ifdef facility of the C-preprocessor.
In order to pass, every required macro must be defined to the
correct value.  If a macro is undefined or defined to the wrong
value, the test case fails.

For every required macro with a numeric value, check that it is
defined to the correct value.

for expfun = expected function identifiers
   macnam = name of macro for expfun
   TEST: #SR 1 2
         macnam + " should be defined as " + expfun + "."
   #ifdef macnam
      pass/fail depending on (macnam = expfun)
   #else
      fail
   #endif
next expfun

for experr = expected error codes
   macnam = name of macro for experr
   TEST: #SR 1 3
         macnam + " should be defined as " + experr + "."
   #ifdef macnam
      pass/fail depending on (macnam = experr)
   #else
      fail
   #endif
next experr

for explin = expected linetypes
   macnam = name of macro for explin
   TEST: #SR 1 4
         macnam + " should be defined as " + explin + "."
   #ifdef macnam
      pass/fail depending on (macnam = explin)
   #else
      fail
   #endif
next explin

for expmrk = expected marker types
   macnam = name of macro for expmrk
   TEST: #SR 1 5
         macnam + " should be defined as " + expmrk + "."
   #ifdef macnam
      pass/fail depending on (macnam = expmrk)
   #else
      fail
   #endif
next expmrk

for expann = expected annotation styles
   macnam = name of macro for expann
   TEST: #SR 1 6
         macnam + " should be defined as " + expann + "."
   #ifdef macnam
      pass/fail depending on (macnam = expann)
   #else
      fail
   #endif
next expann

for expcmd = expected colour models
   macnam = name of macro for expcmd
   TEST: #SR 1 7
         macnam + " should be defined as " + expcmd + "."
   #ifdef macnam
      pass/fail depending on (macnam = expcmd)
   #else
      fail
   #endif
next expcmd

for exppet = expected prompt and echo types
   macnam = name of macro for exppet
   TEST: #SR 1 8
         macnam + " should be defined as " + exppet + "."
   #ifdef macnam
      pass/fail depending on (macnam = exppet)
   #else
      fail
   #endif
next exppet
end processing of numeric macros

for expsym = expected enumeration constant values
   macnam = name of macro for expsym
   TEST: #SR 1 10
         macnam + " should be defined as " + expsym + "."
   #ifdef macnam
      pass/fail depending on (macnam = expsym)
   #else
      fail
   #endif
next expsym

TEST: #SR 1 9
      "PDEF_MEM_SIZE should be defined as ((size_t) (-1))."

#ifdef PDEF_MEM_SIZE
   exp_def_mem = ((size_t) (-1))
   pass/fail depending on (exp_def_mem = PDEF_MEM_SIZE)
#else
   fail
#endif

TEST: #SR 1 9
      "PDEF_ERR_FILE should be defined as ((char *) (0))."

#ifdef PDEF_ERR_FILE
   exp_def_err = ((char *) (0))
   pass/fail depending on (exp_def_err = PDEF_ERR_FILE)
#else
   fail
#endif

TEST: #SR 1 15
      "Size_t should be defined to some implementation dependent value."
#ifdef size_t
   pass
#else
   fail
#endif

END PROGRAM 1