Unit testing Cmockery 简单使用
/**********************************************************************
* 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 简单使用的更多相关文章
- Javascript单元测试Unit Testing之QUnit
body{ font: 16px/1.5em 微软雅黑,arial,verdana,helvetica,sans-serif; } QUnit是一个基于JQuery的单元测试Uni ...
- 读书笔记-实用单元测试(英文版) Pragmatic Unit Testing in C# with NUnit
读书笔记-实用单元测试(英文版) Pragmatic Unit Testing in C# with NUnit Author: Andrew Hunt ,David Thomas with Matt ...
- VS2010(2012)中使用Unit Testing进行单元测试
原文 VS2010(2012)中使用Unit Testing进行单元测试 使用VS 2012自带的Unit Testing工具进行单元测试是非常方便的.网上关于这方面的例子很多,这篇随笔只起个人学习笔 ...
- 体验VS2017的Live Unit Testing
相对于传统的Unit Test,VS2017 带来了一个新的功能,叫Live Unit Testing,从字面意思理解就是实时单元测试,在实际的使用中,这个功能就是可以在编写代码的时候进行实时的bac ...
- Unit Testing of Spring MVC Controllers: “Normal” Controllers
Original link: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-m ...
- Unit Testing of Spring MVC Controllers: Configuration
Original Link: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-m ...
- Live Unit Testing
Live Unit Testing 相对于传统的Unit Test,VS2017 带来了一个新的功能,叫Live Unit Testing,从字面意思理解就是实时单元测试,在实际的使用中,这个功能就是 ...
- [易学易懂系列|rustlang语言|零基础|快速入门|(15)|Unit Testing单元测试]
[易学易懂系列|rustlang语言|零基础|快速入门|(15)] 实用知识 Unit Testing单元测试 我们知道,在现代软件开发的过程中,单元测试对软件的质量极及重要. 今天我们来看看Rust ...
- Unit Testing with NSubstitute
These are the contents of my training session about unit testing, and also have some introductions a ...
随机推荐
- 【BZOJ】【1927】【SDOI2010】星际竞速
网络流/费用流 比较简单的一题,对于每个星球,将它拆成两个点,然后二分图建模:左部结点与S相连,流量为1费用为0:右部结点与T相连,流量为1费用为0:对于每条航道x->y,连边x->y+n ...
- 2014 Multi-University Training Contest 8
官方解题报告:http://blog.sina.com.cn/s/blog_a19ad7a10102uzj7.html Area of Mushroom http://acm.hdu.edu.cn/s ...
- 在线最优化求解(Online Optimization)之四:RDA
在线最优化求解(Online Optimization)之四:RDA 不论怎样,简单截断.TG.FOBOS都还是建立在SGD的基础之上的,属于梯度下降类型的方法,这类型方法的优点就是精度比较高,并且T ...
- window dos 设置网络
->netsh ->pushd interface ip ->set address "本地连接" static 192.168.1.2 255.255.255. ...
- unity3d旋转摄像机脚本
void Update () { )) { if (axes == RotationAxes.MouseXAndY) { // Read the mouse input axis rotationX ...
- asp.net 获取客户机IP地址
/// <summary> ///get client IP /// </summary> /// <returns></returns> public ...
- JavaScript Madness: Dynamic Script Loading
Introduction I've developed some pretty seriously Javascript intensive sites, where the sheer quanti ...
- 1. what is Lua?
glue language Lua is a proven, robust language, small.
- Java 理论和实践: 了解泛型
转载自 : http://www.ibm.com/developerworks/cn/java/j-jtp01255.html 表面上看起来,无论语法还是应用的环境(比如容器类),泛型类型(或者泛型) ...
- linux出现bash: ./java: cannot execute binary file 问题的解决办法
问题现象描述: 到orcal官网上下载了两个jdk: (1)jdk-7u9-linux-i586.tar.gz ------------>32位 (2)jdk-7u9-linux-x64.tar ...