本博客(http://blog.csdn.net/livelylittlefish )贴出作者(三二一@小鱼)相关研究、学习内容所做的笔记,欢迎广大朋友指正!
Content
1. What is CUnit?
2. What are the interfaces?
3. How to use CUnit framework?
4. An example
Appendix installation of CUnit
(1) install curses/ncurses
(2) install CUnit
1. Wha t is CUnit?
(1) CUnit is a system for writing, administering, and running unit tests in C.
(2) It is built as a static library which is linked with the user's testing code.
(3) CUnit uses a simple framework for building test structures, and provides a rich set of assertions for testing common data types.
2. What are the interfaces?
There are some kinds of interfaces of CUnit for running tests and reporting results.
(1) Automated interface with xml output
(2) Basic interface with non-interactive output to stdout
(3) Interactive console interface
(4) Interactive console interface (*nix)
(5) Windows interface (not yet implemented)
3. How to use CUnit framework?
The following is the typical of steps for using CUnit framework.
(1) Write functions for tests (and suite init/cleanup if necessary)
(2) Initialize the test registry, by calling CU_initialize_registry()
(3) Add suites to the test registry, by calling CU_add_suite()
(4) Add tests to the suites, by calling CU_add_test()
(5) Run tests using an appropriate interface, e.g. by calling CU_console_run_tests()
(6) Cleanup the test registry, by calling CU_cleanup_registry()
4. test, suite, registry
Registry 由 1 个或多个 suite 构成;
suite 由 1<