/**********************************************************************
* Unit testing Cmockery 简单使用
* 说明:
* 之前早有听说过Cmockery,但一直没有使用起来,主要是也不知道用来做
* 什么,当然现在其实也不知道用来做什么,不过还是想编译一下,看下效果,
* 然后搞了一个最简单的测试程序看一下效果。
*
* 2016-5-3 深圳 南山平山村 曾剑锋
*********************************************************************/ 一、参考文章:
C单元测试框架之Cmockery
http://c4fun.cn/blog/2014/12/06/cmockery/ 二、编译:
. ./configure
. make
. sudo make install
. sudo ldconfig 三、Demo Test:
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include "cmockery.h" // 注意头文件所在的位置 void testFunction(void **state) {
printf("zengjf.\n");
} int main(int argc, char *argv[])
{
const UnitTest tests[] = {
unit_test(testFunction),
};
return run_tests(tests);
} 四、测试结果:
myzr@myzr:~/c_program$ ./a.out
testFunction: Starting test
zengjf.
testFunction: Test completed successfully.
All tests passed
myzr@myzr:~/c_program$

Unit testing Cmockery 简单使用的更多相关文章

  1. Javascript单元测试Unit Testing之QUnit

    body{ font: 16px/1.5em 微软雅黑,arial,verdana,helvetica,sans-serif; }           QUnit是一个基于JQuery的单元测试Uni ...

  2. 读书笔记-实用单元测试(英文版) Pragmatic Unit Testing in C# with NUnit

    读书笔记-实用单元测试(英文版) Pragmatic Unit Testing in C# with NUnit Author: Andrew Hunt ,David Thomas with Matt ...

  3. VS2010(2012)中使用Unit Testing进行单元测试

    原文 VS2010(2012)中使用Unit Testing进行单元测试 使用VS 2012自带的Unit Testing工具进行单元测试是非常方便的.网上关于这方面的例子很多,这篇随笔只起个人学习笔 ...

  4. 体验VS2017的Live Unit Testing

    相对于传统的Unit Test,VS2017 带来了一个新的功能,叫Live Unit Testing,从字面意思理解就是实时单元测试,在实际的使用中,这个功能就是可以在编写代码的时候进行实时的bac ...

  5. Unit Testing of Spring MVC Controllers: “Normal” Controllers

    Original link: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-m ...

  6. Unit Testing of Spring MVC Controllers: Configuration

    Original Link: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-m ...

  7. Live Unit Testing

    Live Unit Testing 相对于传统的Unit Test,VS2017 带来了一个新的功能,叫Live Unit Testing,从字面意思理解就是实时单元测试,在实际的使用中,这个功能就是 ...

  8. [易学易懂系列|rustlang语言|零基础|快速入门|(15)|Unit Testing单元测试]

    [易学易懂系列|rustlang语言|零基础|快速入门|(15)] 实用知识 Unit Testing单元测试 我们知道,在现代软件开发的过程中,单元测试对软件的质量极及重要. 今天我们来看看Rust ...

  9. Unit Testing with NSubstitute

    These are the contents of my training session about unit testing, and also have some introductions a ...

随机推荐

  1. dede首页调用栏目内容{dedefield.content}的方法

    Dedecms的功能确实很强大,但是dedecms的全局变量有字节限制,使得我们在使用dedecms制作企业站的时候,首页无法调用大段大段的企业站. 其实dedecms还有另外一种调用大段内容的方法, ...

  2. 【BZOJ】【2253】【WC 2010 BeijingWC】纸箱堆叠

    树套树 Orz zyf 我的树套树不知道为啥一直WA……只好copy了zyf的写法TAT 这题还可以用CDQ分治来做……但是蒟蒻不会…… //y坐标的树状数组是按权值建的……所以需要离散化…… /** ...

  3. Bootstrap 基础

    一种前端开发框架,如同YUI 下载源码找开后,其文件结构如下: bootstrap/├── css/│   ├── bootstrap.css│   ├── bootstrap.min.css│   ...

  4. source Insight注册码

    source Insight  vesion3.50.0058 注 册码SI3US-361500-17409

  5. android音乐播放器开发教程

    android音乐播放器开发教程 Android扫描sd卡和系统文件 Android 关于录音文件的编解码 实现米聊 微信一类的录音上传的功能 android操作sdcard中的多媒体文件——音乐列表 ...

  6. 【Linux高频命令专题(3)】uniq

    简述 用途 报告或删除文件中重复的行. 语法 uniq [ -c | -d | -u ] [ -f Fields ] [ -s Characters ] [ -Fields ] [ +Characte ...

  7. LR_问题_脚本运行时提示没有参数化

    问题描述 将loadrunner中的参数删除,并且删除脚本目录下对应的bak,执行脚本,出现下面的错误: “错误: 表“XX\phonenumbser.dat”不存在.         [MsgId: ...

  8. POSIX semaphore: sem_open, sem_close, sem_post, sem_wait

    http://www.cnblogs.com/BloodAndBone/archive/2011/01/18/1938552.html 一.Posix有名信号灯 1.posix有名信号灯函数 函数se ...

  9. ios开发跳转

    如果我的是A->B->C后,我想直接从 C->A 应该怎么做???这是我的问题    看了这个帖子不太明白      这是10楼的解决办法 , 虽然 写的很清楚 ,但是还是没懂啊  ...

  10. 2014-9-17二班----6 web project

    部署  加载 到 Tomcat 6.0 服务器上 web.xml           <welcome>index.jsp </welcome>   <welcome&g ...