Using native C statements

System Testing for C

In some cases, it can be necessary to include portions of C native code inside a .pts test script for one the following reasons:

  • To declare native variables that participate in the flow of a scenario. Such statements must be analyzed by the System Testing Parser.

  • To insert native code into a scenario. In this case, the code is ignored by the parser, but carried on into the generated code.

Analyzed native code

Lines prefixed with a # character are analyzed by Component Testing Parser.

Only prefix statements with a # character to include native C variable declarations that must be analyzed by the parser.

#int i;

#char *foo;

Variable declarations must be placed outside of System Testing Language blocks or preferably at the beginning of scenarios and procedures.

Ignored native code

Lines prefixed with a @ character are ignored by the parser, but copied into the generated code.

To use native C code in the test script, start instructions with a @ character:

@for(i=0; i++; i<100) func(i);

@foo(a,&b,c);

You can add native code either inside or outside of System Testing Language blocks.

Related Topics

CALL Instruction | Basic Structure | System Testing language reference