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等网站开发框架去提高网站开发效率.那么在面试后端开发工程师的时候,面试官可能就会问到网站开发的底层原理是什么? 我们不止仅 ...
随机推荐
- 最佳C/C++编辑器 source insight3
C/C++嵌入式代码编辑器source insight3下载地址 http://www.sourceinsight.com/eval.html 注册码:SI3US-361500-17409
- 《DSP using MATLAB》Problem 2.4
生成并用stem函数画出这几个序列. 1.代码: %% ------------------------------------------------------------------------ ...
- NYOJ-1036 非洲小孩
非洲小孩 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描写叙述 家住非洲的小孩,都非常黑.为什么呢? 第一,他们地处热带,太阳辐射严重. 第二,他们不常常洗澡.(常年缺水, ...
- 让APK 成功在 Windows 运行并可以设置本地文件
让APK 成功在 Windows 运行并可以设置本地文件 安装 ARC Welder. 启动 ARC Welder 后选反apk 文件,下载 zip. 将 zip 解压修改 manifest.json ...
- VirtualBox的vdi映像导入遇到的uuid冲突问题 (转)
virtualbox导入vdi文件时出现下面的问题: 打开hard disk D:\software\GT5.0.0.vdi 失败 Cannot register the hard disk 'D ...
- eclipse 和 Myeclipse中Maven Web项目出现小红叉的 详细解决方法
在我们创建maven项目是常会出现小红叉,如图: 解决办法: 1.可以 点击鼠标右键 maven--->update project.一般可以解决. 2.查看 window---->sh ...
- Bootstrap-CL:超大屏幕
ylbtech-Bootstrap-CL:超大屏幕 1.返回顶部 1. Bootstrap 超大屏幕(Jumbotron) 本章将讲解 Bootstrap 支持的另一个特性,超大屏幕(Jumbotro ...
- expect学习笔记及用法
expect学习笔记及实例详解 expect的基本用法 expect用法
- 利用spring的CommonsMultipartResolver上传文件
1.CommonsMultipartResolver是spring里面提供的一个上传方式,效率我不知道,但是加入spring容器管理还是很不错的. 2.先看依赖包pom.xml <project ...
- 第5课 Qt Creator工程介绍
1. QT Creator工程管理(一个工程包含不同类型的文件) (1).pro项目文件 (2).pro.user用户配置描述文件 (3).h头文件 (4).cpp源文件 (5).ui界面描述文件 ( ...