Skip to content

Commit

Permalink
[test] Add okx() macro taking an explicit file name and line number
Browse files Browse the repository at this point in the history
Allow test reports to specify an explicit file name and line number
using the extended okx() macro.  This allows large blocks of test
report code such as tcpip_random_ok() to be implemented as functions
rather than macros.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jan 6, 2014
1 parent a4e8ef7 commit 23f17f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/include/ipxe/test.h
Expand Up @@ -38,9 +38,12 @@ extern void test_ok ( int success, const char *file, unsigned int line,
* Report test result
*
* @v success Test succeeded
* @v file File name
* @v line Line number
*/
#define ok( success ) do { \
test_ok ( (success), __FILE__, __LINE__, #success ); \
} while ( 0 )
#define okx( success, file, line ) \
test_ok ( success, file, line, #success )
#define ok( success ) \
okx ( success, __FILE__, __LINE__ )

#endif /* _IPXE_TEST_H */

0 comments on commit 23f17f7

Please sign in to comment.