Criterion - 非侵入性的C测试框架

网友投稿 694 2022-10-23

Criterion - 非侵入性的C测试框架

Criterion - 非侵入性的C测试框架

A dead-simple, yet extensible, C and C++ unit testing 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:

C99 and C++11 compatible. Tests are automatically registered when declared. Implements a xUnit framework structure. 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. Unified interface between C and C++: include the criterion header and it just works. Supports parameterized tests and theories. Progress and statistics can be followed in real time with report hooks. TAP output format can be enabled with an option. Runs on Linux, FreeBSD, Mac OS X, and Windows (Compiling with MinGW GCC and Visual Studio 2015+).

Downloads

Packages

Mac OS X: brew install snaipe/soft/criterionAUR: yaourt -S criterion

Binary archives

Binary releases are available on the release page

If you have a different platform, you can still build the library from source

Developer Resources

Documentation

An online documentation is available on ReadTheDocs (PDF | Zip | Epub)

Samples

Sample tests can be found in the sample directory.

A simple testUsing multiple suitesWriting assertionsAdding test fixturesTests with signalsUsing report hooks

Getting help

Misc

autotools skeleton for projects with criterion testsCMake find module for Criterion

Credits

Logo made by Paul Bouigue

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:AQS同步组件-CountDownLatch解析和案例
下一篇:Web三大组件之Filter,Listener和Servlet详解
相关文章

 发表评论

暂时没有评论,来抢沙发吧~