Criterion - 一个简单可扩展的 C 语言测试框架
A dead-simple, yet extensible, C test framework.
Philosophy
Most test frameworks for C require a lot of boilerplate code to set up tests and test suites -- you need to create a main, then register new test suites, then register the tests within these suits, and finally call the right functions.
This gives the user great control, at the unfortunate cost of simplicity.
Criterion follows the KISS principle, while keeping the control the user would have with other frameworks:
- Tests are automatically registered when declared.
- A default entry point is provided, no need to declare a main unless you want to do special handling.
- Test are isolated in their own process, crashes and signals can be reported and tested.
- Progress and statistics can be followed in real time with report hooks.
Installation
$ git clone https://github.com/Snaipe/Criterion.git
$ cd Criterion
$ ./autogen.sh && ./configure && make && sudo make install
Given a test file named test.c, compile it with -lcriterion :
$ gcc -o test test.c -lcriterion
Samples
Sample tests can be found in thesample directory.
Q. What's wrong with other test frameworks?
A. I worked with CUnit and Check, and I must say that they do their job very well -- the only thing that bugs me is that setting up a test suite from scratch is a pain, it should really be simpler. Most (if not all) high-level languages have test frameworks with automatic test registration, but all the ones for C require you to set up a main, manually register suites, then tests. Criterion tries to fix these shortcomings.
Q. Where has this been tested?
A. Currently, on Linux 2.6.32 and Linux 3.15.7, although it should work on most *nix systems. More tests will be added on the build matrix.
Q. Will this work under Windows/MSVC?
A. Windows support with MinGW is coming, but MSVC is a bit of a lost cause for the C language. The project internally uses c99 features and gnu extensions, and MSVC is stuck at supporting c89.
- 本文来自:Linux教程网
Criterion - 一个简单可扩展的 C 语言测试框架的更多相关文章
- 将一个对象相同的属性(不区分大小写)赋值给一个新对象 DataTable的一个简单的扩展
将一个对象相同的属性(不区分大小写)赋值给一个新对象 1 public static T Mapper<S, T>(S source) 2 { 3 T t = Activator.Cr ...
- 《maven实战》笔记(2)----一个简单maven项目的搭建,测试和打包
参照<maven实战>在本地创建对应的基本项目helloworld,在本地完成后项目结构如下: 可以看到maven项目的骨架:src/main/java(javaz主代码)src/test ...
- 一个简单的NetCore项目:1 - 搭建框架,生成数据库
1- 启动项目 安装.NETCORE SDK,教程在网上可以搜索的到,这里就不讲述了.简单粗暴的方式就是安装最新的VS2015. 2-搭建框架 2.1 打开VS新建一个项目,在弹出的新建项目对话框中, ...
- Python实现一个简单三层神经网络的搭建并测试
python实现一个简单三层神经网络的搭建(有代码) 废话不多说了,直接步入正题,一个完整的神经网络一般由三层构成:输入层,隐藏层(可以有多层)和输出层.本文所构建的神经网络隐藏层只有一层.一个神经网 ...
- 一个简单但能考察C语言基础的题目
请看题: #include<stdio.h> int a=1; int main(void) { int a=a; printf("a=d%\n",a); return ...
- DataTable的一个简单的扩展
我们在调试代码的时候经常遇到DataTable的数据类型错误,这个类可以帮助我们很快查看DataTable的结构信息. /// <summary> /// DataTable扩展类 /// ...
- 一个简单的、面向对象的javascript基础框架
如果以后公司再能让我独立做一套新的完整系统,那么我肯定会为这个系统再写一个前端框架,那么我到底该如何写这个框架呢? 在我以前的博客里我给大家展示了一个我自己写的框架,由于当时时间很紧张,做之前几乎没有 ...
- 使用react-native做一个简单的应用-04界面主框架
欢迎界面搭建完毕,我们接下来需要做的就是搭建应用程序的主体框架啦.首先我们看一下首页的截图: 从图中看到,我将首页分为了三部分:用黑色矩形表示的头部,绿色表示的内容和红色表示的底部. 下面我们需要解决 ...
- 手写网站服务器~用Python手动实现一个简单的服务器,不借助任何框架在浏览器中输出任意内容
写在前面的一些P话: 在公司网站开发中,我们往往借助于Flask.Django等网站开发框架去提高网站开发效率.那么在面试后端开发工程师的时候,面试官可能就会问到网站开发的底层原理是什么? 我们不止仅 ...
随机推荐
- zepto 自定义build
为啥要自定义build? 一般来说我们都会直接在官网下,但它只包含默认几个的模块,对于移动开发,这些模块有些是需要的,有些则可以不用.所以我们可以根据自己的需要来定制. 下图为zepto包含的模块,其 ...
- Windows与.NET Framework、数据库版本对应关系
================== windows XP/server 2003 (.NET Framework与 SQL Server\Oracle) 支持.NET版本:.NET Framewor ...
- LeetCode OJ - Best Time to Buy and Sell Stock
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/xiezhihua120/article/details/32939749 Say you have ...
- Web开发需要常见的问题
1.sendRedirec()方法执行后,是会直接跳转到目标页面还是执行完其后的语句再跳转到目标页面??? 该方法在执行完其后面的语句才会跳转到目标页面,比如: public void doGet(H ...
- Chrome 的应用功能越来越强大
Chrome 的应用功能越来越强大 升级到 版本 70.0.3538.77 最早的时候是看到 http 显示地址,现在可以在快捷应用中显示扩展了,还可以看到显示的站点. 现在越来越强大了.
- UOJ 54 【WC2014】时空穿梭——莫比乌斯反演
题目:http://uoj.ac/problem/54 想写20分. Subtask 2 就是枚举4个维度的值的比例,可算对于一个比例有多少个值可以选,然后就是组合数.结果好像不对. 因为模数太小,组 ...
- 转HTTP协议 --- Cookie
转自:http://www.cnblogs.com/TankXiao/archive/2013/04/15/2848906.html Cookie是HTTP协议中非常重要的东西, 之前拜读了Fish ...
- CentOS 下tomcat安装
1. 下载tomcat, http://apache.fayea.com/tomcat/tomcat-8/v8.5.16/bin/apache-tomcat-8.5.16.tar.gz 我下载的是这个 ...
- sqlite性能优化
1.数据库性能上 1.1 批量事务插入,提升数据插入的性能 由于sqlite默认每次插入都是事务,需要对文件进行读写,那么减少事务次数就能简书磁盘读写次数从而获得性能提升. 1.2 单条sql优于多条 ...
- Spark系列(二) Spark Shell各种操作及详细说明
并行化scala集合(Parallelize) //加载数据1~10 val num=sc.parallelize(1 to 10) //每个数据项乘以2,注意 _*2记为一个函数(fun) val ...