/**********************************************************************
* 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. Codeforces Round #347 (Div. 2) C. International Olympiad 找规律

    题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99- ...

  2. 关于make: *** No rule to make target `clean'. Stop.的解决

    在重新编译makefile工程文件时需要用到 #make clean 命令, 但是最近工程使用make clean的时候总是提示: make: *** No rule to make target ` ...

  3. poj 3170

    两遍bfs ~ #include <cstdio> #include <cstdlib> //#include <cmath> #include <map&g ...

  4. unit3d 4.6 document open solution

    发现4.6 的 本地 文档字体解析采用 fonts.googleapis.com ,可是google 自古就与天朝不在一个鼻孔,所以你打开往往需要半天. 网上查了一下,把所有本地的*.html 文档  ...

  5. Unity3d Android程序嵌入Admob广告条

    原地址:http://dong2008hong.blog.163.com/blog/static/4696882720140441353482/ Seems like using a simple A ...

  6. Javascript操作表格隔行变色

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  7. ASP .net(照片列表详细功能演示)

    大家好,今天我们需要讲解的内容就是把上篇文章当中提到的照片列表的很多功能细化去做. 那么之间我们两篇文章的目的就是要让大家深刻体会get,post的使用场景极其作用.像一般处理程序的使用,隐藏域的使用 ...

  8. 安装ubuntu vi编辑无法正常使用的时候 如方向键变成ABCD

    http://blog.sina.com.cn/s/blog_7e3f6e8f0100vkon.html 在使用ubuntu的时候,发现vi编辑模式下退格键backspace和上下左右光标移动键不能用 ...

  9. jQuery对象与Dom对象的相互转换

    1.jQuery对象转换为Dom对象 [index] var $d = $("#id"); ]; get(index) var $d = $("#id"); ) ...

  10. 阿里巴巴fastJson

    FastJson解析 一.阿里巴巴FastJson是一个Json处理工具包,包括“序列化”和“反序列化”两部分,它具备如下特征:速度最快,测试表明,fastjson具有极快的性能,超越任其他的Java ...