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等网站开发框架去提高网站开发效率.那么在面试后端开发工程师的时候,面试官可能就会问到网站开发的底层原理是什么? 我们不止仅 ...
随机推荐
- Ubuntu系统安装,适用于14.04,16.04和17.10
本文以14.04为案例进行安装,其他版本相关问题会做注解 1.选择要安装的系统语言 本界面建议选择English,之后再选择中文安装 注意: 安装服务器版时,对于14.x版本第一步选择中文没有问题,但 ...
- BZOJ3207: 花神的嘲讽计划Ⅰ(hash)
3207: 花神的嘲讽计划Ⅰ Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 3569 Solved: 1258[Submit][Status][Di ...
- BZOJ4033: [HAOI2015]树上染色(树形DP)
4033: [HAOI2015]树上染色 Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 3461 Solved: 1473[Submit][Stat ...
- IO包中的其他类总结
一.PrintStream和PrintWriter PrintStream 为其他输出流添加了功能,使它们能够方便地打印各种数据值表示形式. PrintStream 打印的所有字符都使用平台的默认字符 ...
- yarn import 使用package-lock.json
yarn 1.7(目前最新的版本)支持npm 的package-lock.json 了 环境准备 安装更新yarn sudo npm install -g yarn 查看版本 yarn version ...
- centeros php 实战
apache 默认安装路径 Fedora Core, CentOS, RHEL:ServerRoot :: /etc/httpdPrimary Config Fle ...
- oracle行跟踪(基于行跟踪的ROWDEPENDENCIES ORA_ROWSCN信息)
在Oracle 10g中的引入了ORA_ROWSCN伪列新特性.基于此种伪列所提供的信息,我们可以方便地找出某个数据块或某一个行最近被修改的时间戳.在默认情况下,10g下表会以非行依赖性(NOROWD ...
- mac sublime切换编辑语言的方法(添加其他版本的python)
在sublime中指定python版本,操作如下: Sublime——tools——build system——new build system 把文件中的内容替换为 { "cmd" ...
- beautifulsoup 基本语法
案例一: #coding=utf-8import jsonimport requestsfrom bs4 import BeautifulSoupurl = 'http://www.itest.inf ...
- Linux虚拟机与Windows共享文件
1.找到“虚拟机” >>> “设置” 2.选项 >>> 共享文件夹 >>> 总是启用 >>> 添加,选择你想要共享的文件. 注 ...