📄 cut-pass.c
字号:
/*
* Sample tests, to check test engine.
* See also ../all-pass as well.
*
* By William Tanksley
*
* $log$
*/
#include "cut.h"
/* A pointless example -- tests nothing useful, will never fail.
* This nonetheless shows the basic form of tests. */
void __CUT__sample( void )
{
ASSERT( 1, "Any non-zero value must always pass an ASSERT." );
}
/* A more complex test, consisting of a bringup, a takedown,
* and the test body. */
static int example_broughtup = 0;
void __CUT_BRINGUP__example( void )
{
example_broughtup = 1;
}
void __CUT__example ( void )
{
/* ASSERT explanations are usually phrased as mandatory statements. */
ASSERT( 1 == example_broughtup, "We must be initialized by now." );
}
void __CUT_TAKEDOWN__example( void )
{
/* ASSERTs in takedowns are a very bad idea; takedowns have to be able to
* run at any time, including when a test has thrown an exception. */
example_broughtup = 0;
}
void __CUT__example2( void )
{
ASSERT( 0 == example_broughtup, "We must be uninitialized by now." );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -