Test Unit Pragmas: Difference between revisions
(→Notes) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
[[SCL Pragmas]] <ref>SCL is an acronym for STRIDE Communication Language</ref> comprise a set of compiler directives that allow annotations within C and C++ source files that are meaningful to the [[S2scompile|STRIDE Compiler]] but ignored by standard language compilers. | [[SCL Pragmas]] <ref>SCL is an acronym for STRIDE Communication Language</ref> comprise a set of compiler directives that allow annotations within C and C++ source files that are meaningful to the [[S2scompile|STRIDE Compiler]] but ignored by standard language compilers. | ||
[[SCL Pragmas]] have wide application in remoting of interfaces within the STRIDE runtime environment; the | [[SCL Pragmas]] have wide application in remoting of interfaces within the STRIDE runtime environment; the pragmas that are relevant to [[Test Units|Test Unit]] testing are highlighted here. | ||
== Test Unit Pragmas == | === Test Unit Pragmas === | ||
These pragmas specify [[Test Units]] to the [[S2scompile|STRIDE Compiler]] and--by extension--to the subsequent [[Build Tools]], thus generating [[Intercept Module|IM source code]] that provides [http://en.wikipedia.org/wiki/Test_harness harnessing] for the tests. | These pragmas specify [[Test Units]] to the [[S2scompile|STRIDE Compiler]] and--by extension--to the subsequent [[Build Tools]], thus generating [[Intercept Module|IM source code]] that provides [http://en.wikipedia.org/wiki/Test_harness harnessing] for the tests. | ||
Line 17: | Line 17: | ||
=== Fixturing Pragmas === | === Fixturing Pragmas === | ||
These pragmas specify optional [ | These pragmas specify optional [[Test_Fixturing_in_C/C%2B%2B | test fixturing]] functions/methods that are called immediately before and after each test method in the specified STRIDE [[Test Units|Test Unit]]. | ||
; [[scl_test_setup]] | ; [[scl_test_setup]] | ||
Line 23: | Line 23: | ||
; [[scl_test_teardown]] | ; [[scl_test_teardown]] | ||
: Used to specify a function or method as a teardown fixture for a STRIDE [[Test Units|Test Unit]]. The [[S2scompile|STRIDE Compiler]] will cause [[Intercept Module|IM code]] to be generated that will call the fixture immediately after the execution of each test within the specified test unit. | : Used to specify a function or method as a teardown fixture for a STRIDE [[Test Units|Test Unit]]. The [[S2scompile|STRIDE Compiler]] will cause [[Intercept Module|IM code]] to be generated that will call the fixture immediately after the execution of each test within the specified test unit. | ||
=== Function Pragma === | |||
Any function that is to be [[Function_Capturing#Remoting | remoted]] or [[Function_Capturing#Interception | intercepted]] requires explicit declaration to the [[S2scompile|STRIDE Compiler]]. | |||
; [[scl_function]] | |||
: Used to specify a function for instrumentation. Based on the setup the [[S2scompile|STRIDE Compiler]] will cause [[Intercept Module|IM code]] to be generated for either external exposure or call interception. | |||
<hr/> | <hr/> | ||
'''Notes''' | |||
<references/> | <references/> | ||
[[Category:Test Units]] | |||
[[Category:SCL]] |
Latest revision as of 23:00, 10 June 2011
SCL Pragmas
SCL Pragmas [1] comprise a set of compiler directives that allow annotations within C and C++ source files that are meaningful to the STRIDE Compiler but ignored by standard language compilers.
SCL Pragmas have wide application in remoting of interfaces within the STRIDE runtime environment; the pragmas that are relevant to Test Unit testing are highlighted here.
Test Unit Pragmas
These pragmas specify Test Units to the STRIDE Compiler and--by extension--to the subsequent Build Tools, thus generating IM source code that provides harnessing for the tests.
For additional information and examples, see the linked articles.
- scl_test_class
- Used to specify a C++ class as a STRIDE Test Unit. The STRIDE Compiler will cause IM code to be generated that can instantiate an instance of this class and execute its test methods.
- scl_test_cclass
- Used to specify a C class (structure containing member pointers to test methods) as a STRIDE Test Unit. The STRIDE Compiler will cause IM code to be generated that can instantiate an instance of this class and execute its test methods.
- scl_test_flist
- Used to specify a list of free functions as a STRIDE Test Unit. The STRIDE Compiler will cause IM code to be generated that can execute each test function.
Fixturing Pragmas
These pragmas specify optional test fixturing functions/methods that are called immediately before and after each test method in the specified STRIDE Test Unit.
- scl_test_setup
- Used to specify a function or method as a setup fixture for a STRIDE Test Unit. The STRIDE Compiler will cause IM code to be generated that will call the fixture immediately before the execution of each test within the specified test unit.
- scl_test_teardown
- Used to specify a function or method as a teardown fixture for a STRIDE Test Unit. The STRIDE Compiler will cause IM code to be generated that will call the fixture immediately after the execution of each test within the specified test unit.
Function Pragma
Any function that is to be remoted or intercepted requires explicit declaration to the STRIDE Compiler.
- scl_function
- Used to specify a function for instrumentation. Based on the setup the STRIDE Compiler will cause IM code to be generated for either external exposure or call interception.
Notes
- ↑ SCL is an acronym for STRIDE Communication Language