Previous: TESTSTRING, Up: Test Macros


3.2.9 TEST_RUN

Execute a statement, then test an expression against a value

Synopsis

     #include <testlib.h>
     
     TEST_RUN(desc, stmt, expr, res )
     TEST_RUN_LINE(line, desc, stmt, expr, res )

Parameters

line
the line number to output
desc
a short description of the test being performed
stmt
a statement to be executed, independent of the expression. the statement may be arbitrarily complex.
expr
an expression to evaluate
res
the expected result of the expression

Description

TEST_RUN is called to determine the equivalence of an expression with an expected result. The supplied stmt is first executed.

Example

TEST_RUN( "equiv", foo(&x), 33 * x, 36 );