cunit安装中打桩函数是什么

C开发中的单元测试(Cunit) - linux先生 - 博客园
C开发中的单元测试
最近在写C代码的过程中,感觉自己在重复一项必不可少的环节,就是自测代码,这使我想起以前在写JAVA时的Junit带来的快捷和方便,于是马上行动,经百度、谷歌几轮后,发现Cunit工具,看名字,就可猜到它与Junit同属一宗。网上的相关内容也都非常雷同,这里不再详述,有兴趣的话,可以直奔官方文档:
经过仔细观赏,要借用Cunit来提高自己的编码效率和质量,有必要先搞清它的几项要点:首先仔细观察下图:
可以看出Cunit也是有组织的,呵呵,主要分几个角色,Registry,Suite及Test方法。可以通过下面例子,体会到这种组织关系。按官方文档说明,使用Cunit的主要步骤有:1) Write functions for tests (and suite init/cleanup if necessary). 2) Initialize the test registry - CU_initialize_registry() 3) Add suites to the test registry - CU_add_suite() 4) Add tests to the suites - CU_add_test() 5) Run tests using an appropriate interface, e.g. CU_console_run_tests 6) Cleanup the test registry - CU_cleanup_registry
本人英文不咋地,就不献丑翻译了,直接用英文理解吧(要努力用英文).下面我们结合一个小实例,来体验一下Cunit的便利吧(学编程,最有效的方式还是自己动手)先编写一个具体两个简单功能的函数,然后写Testcase来测试它。文件主要有:1) strformat.h :字符串功能函数的接口文件2)strformat.c :字符串功能函数的实现3)testcase.c : 测试用例及Cunit运行环境4)makefile : 下面直奔代码:代码:strformat.h
1 /* strformat.h ---
* Filename: strformat.h
* Description: 字符串操作头文件
* Author: magc
* Maintainer:
* Created: 一
8月 20 22:57:19 2012 (+0800)
* Version:
* Last-Updated: 六
8月 25 10:31:30 2012 (+0800)
Update #: 15
* Keywords:
* Compatibility:
18 /* Commentary:
* 为的是体验Cunit而临时写的几项功能函数,没有多大实际意义,仅仅是为了写测试类
24 /* Change Log:
29 /* Code: */
31 #ifndef _strformat_h
32 #define _strformat_h
34 typedef char * string;
36 /*************************************************************************
37 *功能描述:返回字符串的长度
38 *参数列表:
39 *返回类型:
40 **************************************************************************/
41 int string_lenth(string word);
42 /*************************************************************************
43 *功能描述:返回字符串的大写形式
44 *参数列表:
45 *返回类型:
46 **************************************************************************/
47 string to_Upper(string word);
48 /*************************************************************************
49 *功能描述:连接字符串
50 *参数列表:
51 *返回类型:
52 **************************************************************************/
53 string add_str(string word1 ,string word2);
60 /* strformat.h ends here */
代码:strformat.c
1 /* strformat.c ---
* Filename: strformat.c
* Description: 字符串操作
* Author: magc
* Maintainer:
* Created: 一
8月 20 22:56:36 2012 (+0800)
* Version:
* Last-Updated: 六
8月 25 10:33:07 2012 (+0800)
Update #: 33
* Keywords:
* Compatibility:
18 /* Commentary:
* 此代码仅为体验Cunit而临时撰写。
24 /* Change Log:
29 /* Code: */
30 #include &assert.h&
31 #include &ctype.h&
32 #include &errno.h&
33 #include &limits.h&
34 #include &string.h&
35 #include &stdarg.h&
36 #include &stdlib.h&
37 #include &stdio.h&
38 #include "strformat.h"
41 /**************************************************************************
42 函数名称:字符串相加
43 功能描述:
44 输入参数:
46 **************************************************************************/
47 string add_str(string word1 ,string word2){
return (strcat(word1, word2));
51 /**************************************************************************
52 函数名称:将字符串转换成大写格式
53 功能描述:
54 输入参数:
56 **************************************************************************/
57 string to_Upper(string word){
for(i = 0;word[i] !='\0' ;i++){
if(word[i]&'z' && word[i]&'a'){
word[i] -= 32;
68 /**************************************************************************
69 函数名称:字符串长度
70 功能描述:
71 输入参数:
73 **************************************************************************/
74 int string_lenth(string word){
for(i = 0 ;word[i] != '\0';i++){
82 /* strformat.c ends here */
测试代码: testcase.c
1 /* testcase.c ---
* Filename: testcase.c
* Description: 测试实例
* Author: magc
* Maintainer:
* Created: 一
8月 20 23:08:53 2012 (+0800)
* Version:
* Last-Updated: 五
8月 24 16:09:40 2012 (+0800)
Update #: 135
* Keywords:
* Compatibility:
18 /* Commentary:
* 当前文件用来定义测试方法,suite,及registry信息,若测试方法有变化,只需要修改当前文件即可。
* 第一步:书写测试函数的代码,建议以"test_"为前缀。
* 第二步:将测试方法归类,即将相似功能的测试方法放到一个数组里,以便把它们指定给一个suite
* 第三步:创建suite,可按功能或模块,生成多个test suite,
* 第四步:书写测试方法的总调用方法,AddTests(),用来统一启动测试方法。
26 /* Change Log:
31 /* Code: */
32 #include &assert.h&
33 #include &ctype.h&
34 #include &errno.h&
35 #include &limits.h&
36 #include &string.h&
37 #include &stdarg.h&
38 #include &stdlib.h&
39 #include &stdio.h&
41 #include &CUnit/Basic.h&
42 #include &CUnit/Console.h&
43 #include &CUnit/CUnit.h&
44 #include &CUnit/TestDB.h&
45 #include "strformat.h"
47 /**************************************************************************
48 函数名称:测试string_lenth()方法
49 功能描述:
50 输入参数:
52 **************************************************************************/
53 void test_string_lenth(void){
string test = "Hello";
int len = string_lenth(test);
CU_ASSERT_EQUAL(len,5);
59 /**************************************************************************
60 函数名称:测试方法to_Upper()
61 功能描述:
62 输入参数:
64 **************************************************************************/
66 void test_to_Upper(void){
char test[] = "Hello";
CU_ASSERT_STRING_EQUAL(to_Upper(test),"HELLO");
72 /**************************************************************************
73 函数名称:测试方法 add_str()
74 功能描述:
75 输入参数:
77 **************************************************************************/
78 void test_add_str(void){
char test1[] = "Hello!";
char test2[] = "MGC";
CU_ASSERT_STRING_EQUAL(add_str(test1,test2),"Hello!MGC");
85 /**************************************************************************
86 数组名称:将多个测试方法打包成组,以供指定给一个Suite
87 功能描述:每个suite可以有一个或多个测试方法,以CU_TestInfo数组形式指定
88 **************************************************************************/
89 // CU_TestInfo是Cunit内置的一个结构体,它包括测试方法及描述信息
90 CU_TestInfo testcase[] = {
{"test_for_lenth:",test_string_lenth
{"test_for_add:",test_add_str
CU_TEST_INFO_NULL
96 CU_TestInfo testcase2[] = {
{"test for Upper :",test_to_Upper
CU_TEST_INFO_NULL
101 /**************************************************************************
102 函数名称:suite初始化过程
103 功能描述:
104 输入参数:
106 **************************************************************************/
107 int suite_success_init(void){
112 /**************************************************************************
113 函数名称:suite清理过程,以便恢复原状,使结果不影响到下次运行
114 功能描述:
115 输入参数:
117 **************************************************************************/
118 int suite_success_clean(void){
122 //定义suite数组,包括多个suite,每个suite又会包括若干个测试方法。
123 CU_SuiteInfo suites[] = {
{"testSuite1",suite_success_init,suite_success_clean,testcase},
{"testsuite2",suite_success_init,suite_success_clean,testcase2},
CU_SUITE_INFO_NULL
129 /**************************************************************************
130 函数名称:测试类的调用总接口
131 功能描述:
132 输入参数:
134 **************************************************************************/
135 void AddTests(){
assert(NULL != CU_get_registry());
assert(!CU_is_test_running());
if(CUE_SUCCESS != CU_register_suites(suites)){
exit(EXIT_FAILURE);
144 /*************************************************************************
145 *功能描述:运行测试入口
146 *参数列表:
147 *返回类型:
148 **************************************************************************/
150 int RunTest(){
if(CU_initialize_registry()){
fprintf(stderr, " Initialization of Test Registry failed. ");
exit(EXIT_FAILURE);
AddTests();
/**** Automated Mode *****************
CU_set_output_filename("TestMax");
CU_list_tests_to_file();
CU_automated_run_tests();
//************************************/
/***** Basice Mode *******************
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
//************************************/
/*****Console Mode ********************
CU_console_run_tests();
//************************************/
CU_cleanup_registry();
return CU_get_error();
178 /*************************************************************************
179 *功能描述:测试类主方法
180 *参数列表:
181 *返回类型:
182 **************************************************************************/
184 int main(int argc, char * argv[])
RunTest();
194 /* testcase.c ends here */
注:1)注意结合上面Cunit的组织结构图,理解Cunit中几个角色的关系(CU_TestInfo,CU_SuiteInfo各以数组的形式,将多个Test和Suite组织起来)。2)Cunit有几种运行模式,如automated,basic,console,有的是可以交互的,有的是没有交互,直接出结果的。
代码:makefile
IINC=-I/usr/local/include/CUnit
LIB=-L/usr/local/lib/
strformat.c testcase.c
gcc -o test $(INC) $(LIB)
$^ -lcunit -static
注:1)Cunit安装很简单,从官方地址上下载源代码后,在本机依次执行 ./configure make& sudo make install安装成功后相关的库及头文件安装到默认路径下。编译时添加选项:-I/usr/local/include/CUnit-L/usr/local/lib/就如makefile中的一样。
下面我们欣赏一下Cunit的常见几种运行模式1)Automated Mode先将testcase.c中156~159代码放开注释,此时便是以automated模式运行,此模块没有交互能力,直接生成XML格式的报表,先make,然后运行后,在当前目录下生成两个报表TestMax-Listing.xml和TestMax-Results.xml(前者是测试用例的列表,后者是测试用例的测试结果) ,但这两个文件是不能直接观看的,要查看这两个文件,需要使用如下xsl和dtd文件:CUnit-List.dtd和CUnit-List.xsl用于解析列表文件, CUnit-Run.dtd和CUnit-Run.xsl用于解析结果文件。这四个文件在CUnit包里面有提供,安装之后在$(PREFIX) /share/CUnit目录下,默认安装的话在/home/lirui/local/share/CUnit目录下。在查看结果之前,需要把这六 个文件:TestMax-Listing.xml, TestMax-Results.xml, CUnit-List.dtd, CUnit-List.xsl, CUnit-Run.dtd, CUnit-Run.xsl拷贝到一个目录下,然后用浏览器打开两个结果的xml文件就可以了。如下图所示:
2) Console Mode在testcase.c中将其它模式代码注释掉,放开168行代码,便转换成Console模式了。console模式支持交互,如支持运行,查看错误等操作,如下图所示:
从上图即可看出,输入R来运行,输入F来查看错误用例,输入Q来退出
这种模式在实际中是很实用的。
3)Basic Mode在testcase.c中将其它模式的代码注释掉,放到163~164行代码,便转换成Basic模式,这种是不支持交互的,直接打印出运行结果。
可以看出,这种模式也是比较简单快捷的
另外对于这种写测试代码的重复工作,可以想办法减小重复,还好,我用的是Emacs写代码,可以借助强大的msf-abbrev 来定义一个testcase的模板,每次写测试时,可以直接引入,既简单又快捷,使自己将有限的精力集中到更核心的部分。(假如你不知我在说什么,就当没看到这部分,直接闪过)
小结:以后写代码过程中,若需要测试函数的功能,就可以采用如下步骤:1)创建一个专门的测试类,用msf-abbrev模板快捷创建内容,2) 添加测试函数3) 将测试函数按组放到CU_TestInfo数组中,并指定给一个Suite4)根据自己需要,定义CU_SuiteInfo数组。5)在RunTest()中定义运行模式。6)在main函数中调用RunTest(),默认生成的testcase中有一个main函数,若不与其它冲突,直接在这里调用即可。(若main冲突,则砍掉不需要的那个)10639人阅读
CUnit下载地址: CUnit 在线文档帮助:http://cunit.sourceforge.net/doc/index.html
关于CUnit, 本文主要从介绍三方面的内容:1.CUnit的介绍。1.1 介绍如何使用CUnit。
CUnit是一个对C语言编写的程序进行单元测试的框架,在线文档说它作为一个静态链接库被链接到用户的测试代码中。它提供了一种简洁的框架来建立测试架构,并提供丰富的断言(Assertion)来测试通用数据类型。除此之外,它还提供了许多不同的结构来运行测试用例和报告测试结果。
(1)CUnit的架构&&&&&&&&&&&&&&&&&&&&& Test Registry&&&&&&&&&&&&&&&&&&&&&&&&&&& |&&&&&&&&&&&& ------------------------------&&&&&&&&&&&& |&&&&&&&&&&&&&&&&&&&&&&&&&&& |&&&&&&&&& Suite '1'&&&&& . . . .&&&&&& Suite 'N'&&&&&&&&&&&& |&&&&&&&&&&&&&&&&&&&&&&&&&&& |&&&&&& ---------------&&&&&&&&&&&& ---------------&&&&&& |&&&&&&&&&&&& |&&&&&&&&&&&& |&&&&&&&&&&&& |&&& Test '11' ... Test '1M'&&&& Test 'N1' ... Test 'NM'
提到这个框架,为后面如何使用CUnit提供了基础。先介绍这个框架,从底层往上介绍就两句话:(1)每个测试用例被包装在一个测试包(suite)中,(2)每个测试包(suite)是在有效的测试注册单元(Test Registry)中注册的。
对于CUnit来说,它是单线程运行,所以每次只能有一个有效的测试注册单元(Test Registry),这个测试注册单元下面可以包含多个测试包(suite),每个测试包可以拥有多个测试用例。划分测试包(suite)的规则可以自由约定,比如按照模块来划分,一个模块的测试用例集中到一个测试包中(suite)。至于测试用例,则用来测试模块内部的函数。测试用例函数通过提供的各类输入调用被测试的函数,返回执行结果,然后通过CUnit提供的断言来判断被测试的函数是否正确。
(2)测试模式
下面是四种测试模式:1 Automated Output to xml file&&&&&&&&&&& Non-interactive2 Basic&&&&& Flexible programming&&&&&&& interface Non-interactive& 3 Console&&& Console interface (ansi C)&&&& Interactive& 4 Curses&&&& Graphical interface (Unix)&&&& Interactive第一种模式是将结果输出到XML文档中,便于生成报告。第二种模式是每一次运行结束之后在standard output中显示测试结果,不能保留测试结果数据。第三种模式是console方式的,可以人机交互;前两种模式是非交互式的。第四种只在Unix中使用。
(3)测试的基本流程1)编写单元测试函数(有必要的话要写suite的init/cleanup函数)。Write functions for tests (and suite init/cleanup if necessary). 2)调用函数CU_initialize_registry()初始化测试注册单元(Test Registry)。 Initialize the test registry - CU_initialize_registry() 3)调用函数CU_add_suite() 将测试包(suite)添加到测试注册单元(Test Registry)中。Add suites to the test registry - CU_add_suite() 4)调用函数CU_add_test()将测试用例添加到测试包(suite)中。Add tests to the suites - CU_add_test() 5)使用合适的接口来运行测试用例。Run tests using an appropriate interface, e.g. CU_console_run_tests 6)调用函数CU_cleanup_registry清除测试注册单元(Test Registry)。Cleanup the test registry - CU_cleanup_registry()
1.2 通过一个例子来说明使用方法。先说明文件的组织结构:1.被测试的模块:(1)文件MainModule.c,定义了一个求和函数cal_num。(2)头文件MainModule.h,声明了求和函数cal_num。2.测试用例和测试包(1)文件TestMainModule.c,定义了测试用例。3.单元测试运行入口(1)文件CUnitRunTest.c
各个文件的内容如下:
【1】MainModule.h
#ifndef __MAIN_MODULE_H__
#define __MAIN_MODULE_H__
#include &stdio.h&
//计算两个数之和
int cal_num(int a, int b);
【2】MainModule.c
#include "MainModule.h"
////计算两个数之和
int cal_num(int a, int b)
【3】TestMainModule.c
#include &stdio.h&
#include &assert.h&
#include "CUnit-2.1-0/include/CUnit/console.h"
#include "MainModule.h"
int InitSuite()
int EndSuite()
int Test_Is_Equal(int a, int b, int real)
result = cal_num(a, b);
if(result == real)
int Test_Is_Not_Equal(int a, int b, int real)
result = cal_num(a, b);
if(result != real)
void Test1()
CU_ASSERT(Test_Is_Equal(3, 4, 7));
void Test2()
CU_ASSERT(Test_Is_Not_Equal(4, 5, 10));
/*0 表示成功,1表示失败*/
int AddTestMainModule()
CU_pSuite pSuite = NULL;
/***************
* 1. CU_add_suite 增加一个Suite
* 2. Suite名字 : testSuite
* 3. InitSuite EndSuite:分别是测试单元初始和释放函数,如不需要则NULL传递
****************/
pSuite = CU_add_suite("testSuite", InitSuite, EndSuite);
//检测注册Suite情况
if(NULL == pSuite)
//return 1;
/***************
* 1. 注册当前Suite下的测试用例 
* 2. pSuite:用例指针
* 3. "Test1": 测试单元名称
* 4. Test1:测试函数
***************/
if( NULL == CU_add_test(pSuite, "Test1", Test1) ||
NULL == CU_add_test(pSuite, "Test2", Test2))
/***另外一种测试方式***************/
CU_TestInfo testcases[] = {
{"Test1:", Test1},
{"Test2:", Test2},
CU_TEST_INFO_NULL
CU_SuiteInfo suites[] = {
{"Testing the function cal_num:", InitSuite, EndSuite, testcases},
CU_SUITE_INFO_NULL
if(CUE_SUCCESS != CU_register_suites(suites))
/************************************/
【4】CUnitRunTest.c
#include &stdio.h&
#include &assert.h&
#include "CUnit-2.1-0/include/CUnit/console.h"
extern int AddTestMainModule();
int main()
//CU_initialize_registry 注册函数注册一个用例返回CUE_系列异常值
if( CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
//CU_get_registry 返回注册到用例指针
assert(NULL != CU_get_registry());
//检测是否在执行
assert(!CU_is_test_running());
//调用测试模块完成测试用例
if (0 != AddTestMainModule())
CU_cleanup_registry();
return CU_get_error();
//使用console控制交互界面的函数入口
CU_console_run_tests();
/***使用自动产生XML文件的模式********
CU_set_output_filename("TestMax");
CU_list_tests_to_file();
CU_automated_run_tests();
***********************************/
//调用完毕清除注册信息
CU_cleanup_registry();
2.在两种不同环境下使用CUnit来上面的例子进行单元测试。
2.1 在Windows XP下,在VC 6.0 集成CUnit来进行单元测试。(1)自己动手生成链接静态库CUnit.lib。下载CUnit-2.1-0-src.zip,解压,在CUnit-2.1-0/CUnit目录下,用VC 6.0打开工程文件CUnit.dsp,有个提示,说没有找到workspace文件,不会理会,直接确定。然后在当前打开的工程项目中,点击"FileView",展开文件树形结构,任意点击一个文件打开,然后在最上面的工具栏点击&编译&和&链接&,在CUnit-2.1-0/CUnit目录下就生产CUnit.lib。(2)在VC 6.0新建一个名为"Test_CUit"的Win32 console application工程,将上面例子中的文件包含进来。(3)下载CUnit-2.1-0-winlib.zip,解压,把解压的目录CUnit-2.1-0复制到当前的工程目录下。(4)将CUnit.lib叶复制到当前的工程目录下,并在"Project"-&"Settings..."-&"Link"-&"Object/library modules"中内容的末尾增加CUnit.lib,用空格和前面的静态库文件隔开,然后点击"OK"即可。(5)在"Test_CUit"工程项目中,在最上面的工具栏点击&编译&-&&链接&-&&运行&,就可以看到控制台界面。输入相应的操作符号进行对应的操作,不再详述。
备注:在TestMainModule.c的AddTestMainModule()函数中注释掉的部分是第一种测试模式"Automated Output to xml file",默认的模式是第三种控制台模式。把控制台模式注释掉,而把第一种测试模式打开,则运行时会在当前目录下三个XML文件:CUnit-Memory-Dump.xml,TestMax-Listing.xml,TestMax-Results.xml。将这三个文件复制到目录CUnit-2.1-0/share/CUnit下,然后用浏览器打开后两个XML文件,可以看到测试报告的结果。
2.2 在Linux下,利用CUnit来进行单元测试。1.编译CUnit,编译后,头文件目录在/root/local/include/CUnit中,静态库文件在/root/local/lib/下。(1)用root用户登录,下载CUnit-2.1-0-src.tar.gz。(2)tar -zxvf CUnit-2.1-0-src.tar.gz(3)cd CUnit-2.1-0(4)./configure --prefix=$HOME/local(5)make(6)make install2.编写一个Makefile文件,放入到在源文件目录中,内容如下:
INC=-I/root/local/include
LIB=-L/root/local/lib
all: MainModule.c TestMainModule.c CUnitRunTest.c
gcc $^ -o test $(INC) $(LIB) -lcunit -lcurses -static
rm -rf test
3.在源文件目录下执行make命令即可。4.运行./test即可看见console命令界面。
3.关于断言的使用CUnit提供了一系列的断言来测试逻辑条件,这些断言的成功或是失败的结果都由CUnit单元测试框架跟踪,并在单元测试结束后可以看到。每个断言测试一个逻辑条件。如果选择"XXX_FATAL"这些断言,意味着断言失败后单元测试用例不再继续执行,所以带"FATAL"的断言版本需要谨慎使用。断言被包含在"CUnit/CUnit.h"这个头文件中声明的。现在就从CUnit的文档说明中摘录它的断言声明。
CU_ASSERT(int expression)CU_ASSERT_FATAL(int expression)CU_TEST(int expression)CU_TEST_FATAL(int expression)
Assert that expression is TRUE (non-zero)
CU_ASSERT_TRUE(value)CU_ASSERT_TRUE_FATAL(value)
Assert that value is TRUE (non-zero)
CU_ASSERT_FALSE(value)CU_ASSERT_FALSE_FATAL(value)
Assert that value is FALSE (zero)
CU_ASSERT_EQUAL(actual, expected)CU_ASSERT_EQUAL_FATAL(actual, expected)
Assert that actual = = expected
CU_ASSERT_NOT_EQUAL(actual, expected))CU_ASSERT_NOT_EQUAL_FATAL(actual, expected)
Assert that actual != expected
CU_ASSERT_PTR_EQUAL(actual, expected)CU_ASSERT_PTR_EQUAL_FATAL(actual, expected)
Assert that pointers actual = = expected
CU_ASSERT_PTR_NOT_EQUAL(actual, expected)CU_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected)
Assert that pointers actual != expected
CU_ASSERT_PTR_NULL(value)CU_ASSERT_PTR_NULL_FATAL(value)
Assert that pointer value == NULL
CU_ASSERT_PTR_NOT_NULL(value)CU_ASSERT_PTR_NOT_NULL_FATAL(value)
Assert that pointer value != NULL
CU_ASSERT_STRING_EQUAL(actual, expected)CU_ASSERT_STRING_EQUAL_FATAL(actual, expected)
Assert that strings actual and expected are equivalent
CU_ASSERT_STRING_NOT_EQUAL(actual, expected)CU_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected)
Assert that strings actual and expected differ
CU_ASSERT_NSTRING_EQUAL(actual, expected, count)CU_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count)
Assert that 1st count chars of actual and expected are the same
CU_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count)CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count)
Assert that 1st count chars of actual and expected differ
CU_ASSERT_DOUBLE_EQUAL(actual, expected, granularity)CU_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity)
Assert that |actual - expected| &= |granularity|Math library must be linked in for this assertion.
CU_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity)CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity)
Assert that |actual - expected| & |granularity|Math library must be linked in for this assertion.
CU_PASS(message)
Register a passing assertion with the specified message. No logical test is performed.
CU_FAIL(message)CU_FAIL_FATAL(message)
Register a failed assertion with the specified message. No logical test is performed
给出两个版本的源代码供下载。注:在VC6.0下面的源文件不能直接在Linux下使用,如果要用,则提示每个源文件的末尾都要加一个换行符。
【2】(无法上传.tar.gz格式的文件)&
引用及参考资料:[1]http://blog.csdn.net/colin719/archive//1420583.aspx[2]http://cunit.sourceforge.net/doc/introduction.html[3]/yshsh/blog/item/ea2e0af.html[4]http://blog.csdn.net/jiantiantian/archive//3546887.aspx
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:285654次
积分:3421
积分:3421
排名:第4476名
原创:73篇
评论:158条
(1)(1)(5)(1)(1)(1)(3)(4)(1)(1)(3)(11)(3)(3)(7)(9)(1)(2)(2)(3)(2)(2)(8)(4)}

我要回帖

更多关于 cunit安装 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信