📄 x214.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><TITLE>Multiple suites run through the same SRunner </TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINKREL="HOME"TITLE="Check Tutorial"HREF="index.html"><LINKREL="UP"TITLE="Advanced Features "HREF="c163.html"><LINKREL="PREVIOUS"TITLE="Test fixtures "HREF="x183.html"><LINKREL="NEXT"TITLE="Testing signal handling "HREF="x220.html"></HEAD><BODYCLASS="SECTION"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Check Tutorial</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x183.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 4. Advanced Features</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x220.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECTION"><H1CLASS="SECTION"><ANAME="AEN214">4.4. Multiple suites run through the same SRunner</A></H1><P>In a large program, it will be convenient to create multiple suites, each testing a module of the program. While one can create several test programs, each running one Suite, it may be convenient to create one main test program, and use it to run multiple suites. The Check test suite provides an example of how to do this. The main testing program is called check_check, and has a header file that declares suite creation functions for all the module tests: </P><PRECLASS="PROGRAMLISTING">Suite *make_sub_suite(void);Suite *make_sub2_suite(void);Suite *make_master_suite(void);Suite *make_list_suite(void);Suite *make_msg_suite(void);Suite *make_log_suite(void);</PRE><P>The function srunner_add_suite is used to add additional suites to an SRunner. Here is the code to setup and run the SRunner in the main function: </P><PRECLASS="PROGRAMLISTING">SRunner *sr;sr = srunner_create(make_master_suite());srunner_add_suite(sr, make_list_suite());srunner_add_suite(sr, make_msg_suite());srunner_add_suite(sr, make_log_suite());</PRE></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x183.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x220.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Test fixtures</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="c163.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Testing signal handling</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -