![]() |
![]() |
![]() |
Cutter Reference Manual | ![]() |
---|
READMEREADME |
Cutter is an Unit Testing Framework for C.
This is a list of features of Cutter:
easy to write tests.
outputs result with useful format for debugging.
tests are build as shared libraries.
<URL:http://sourceforge.net/project/showfiles.php?group_id=208375>
% svn co https://cutter.svn.sourceforge.net/svnroot/cutter/trunk cutter
% cutter [Options] [Directory which has libtest_*.so]
Cutter prepends DIRECTORY to file name when test fails. This is for tolls (like Emacs) which have function jumping to error line.
Cutter runs test cases that is matched with TEST_CASE_NAME1, TEST_CASE_NAME2 or .... If TEST_CASE_NAME is surrounded by "/" (e.g. /test_/), TEST_CASE_NAME is handled as regular expression.
Cutter runs tests that is matched with TEST_NAME1, TEST_NAME2 or .... If TEST_NAME is surrounded by "/" (e.g. /test_/), TEST_NAME is handled as regular expression.
Cutter runs a test case in a new thread.
Cutter shows all available UIs and exits.
It specifies UI. The default is console UI.
It specifies verbose level.
This option is only for console UI.
If 'yes' or 'true' is specified, Cutter uses colorized output by escape sequence. If 'no' or 'false' is specified, Cutter never use colorized output. If 'auto' or option is omitted, Cutter uses colorized output if available.
This option is only for console UI.
Executing flow of test is the following.
Write test.
Compile it and build libtest_*.so.
Execute cutter. It loads libtest_*.so and runs them.
See TUTORIAL and sample/stack/.
The following is a template of test.
#include <cutter.h> #include "HEADER_FILE_OF_YOUR_PROGRAM" void test_condition(void); void test_strstr(void); static int condition = 0; void setup (void) { condition = 1; } void teardown (void) { condition = 0; } void test_condition(void) { cut_assert_equal_int(1, condition, "The condition value should be set to 1 in setup()"); ... } void test_strstr(void) { cut_assert_equal_string("sub-string", strstr("string sub-string", "sub")); ... }