diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-01-17 18:42:26 +0100 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-01-17 18:42:26 +0100 |
commit | a2ea867089af0df048ea5b75b8a6b56c524d2429 (patch) | |
tree | 5676063bef98036e4102e864132a833d1c5e5751 | |
parent | 10a7915da2c21146e7b2b12c08ce58fcaae9a056 (diff) | |
download | mtest-a2ea867089af0df048ea5b75b8a6b56c524d2429.tar.gz mtest-a2ea867089af0df048ea5b75b8a6b56c524d2429.tar.bz2 mtest-a2ea867089af0df048ea5b75b8a6b56c524d2429.zip |
moved man to separated directory, updated mans
-rw-r--r-- | man/man3/mt_assert.3 (renamed from mt_assert.3) | 10 | ||||
-rw-r--r-- | man/man3/mt_defs.3 (renamed from mt_defs.3) | 26 | ||||
-rw-r--r-- | man/man3/mt_defs_ext.3 (renamed from mt_defs_ext.3) | 0 | ||||
-rw-r--r-- | man/man3/mt_fail.3 (renamed from mt_fail.3) | 0 | ||||
-rw-r--r-- | man/man3/mt_ferr.3 (renamed from mt_ferr.3) | 0 | ||||
-rw-r--r-- | man/man3/mt_fok.3 (renamed from mt_fok.3) | 15 | ||||
-rw-r--r-- | man/man3/mt_return.3 (renamed from mt_return.3) | 8 | ||||
-rw-r--r-- | man/man3/mt_run.3 (renamed from mt_run.3) | 19 | ||||
-rw-r--r-- | man/man3/mt_run_named.3 (renamed from mt_run_named.3) | 0 | ||||
-rw-r--r-- | man/man7/mtest_overview.7 (renamed from mtest_overview.7) | 13 |
10 files changed, 57 insertions, 34 deletions
diff --git a/mt_assert.3 b/man/man3/mt_assert.3 index 961f21d..e04ea20 100644 --- a/mt_assert.3 +++ b/man/man3/mt_assert.3 @@ -1,6 +1,7 @@ -.TH "MT_ASSERT" "3" "15 January 2018 (v1.1.0)" "bofc.pl" +.TH "MT_ASSERT" "3" "17 January 2018 (v1.1.0)" "bofc.pl" .SH NAME + mt_assert, mt_fail - test checks macros .SH SYNOPSIS @@ -19,13 +20,14 @@ shell .BI "mt_fail <" expression ">" .SH DESCRIPTION -Macro \fBmt_assert\fR() evaluates \fIexpression\fR and if it evaluates to false, + +Macro \fBmt_assert\fR(3) evaluates \fIexpression\fR and if it evaluates to false, test will be marked as failed and information about assert will be printed. Information contains \fIfunction_name\fR, line where assert occured, and \fIexpression\fR that caused test to fail. Also macro forces function it was called in to immediately return. -\fBmt_fail\fR() works just as \fBmt_assert\fR() but function is not forced to +\fBmt_fail\fR(3) works just as \fBmt_assert\fR(3) but function is not forced to exit and can continue execution. This is good when test allocates some memory and we need to clean up before returning. @@ -34,9 +36,11 @@ and we need to clean up before returning. Proper example can be found in \fBmtest_overview\fR(7). .SH "SEE ALSO" + .BR mt_defs (3), .BR mt_defs_ext (3), .BR mt_run (3), +.BR mt_run_named (3), .BR mt_fok (3), .BR mt_ferr (3), .BR mt_return (3), diff --git a/mt_defs.3 b/man/man3/mt_defs.3 index 8408842..10d6b02 100644 --- a/mt_defs.3 +++ b/man/man3/mt_defs.3 @@ -1,9 +1,11 @@ -.TH "MT_DEFS" "3" "15 January 2018 (v1.1.0)" "bofc.pl" +.TH "MT_DEFS" "3" "17 January 2018 (v1.1.0)" "bofc.pl" .SH NAME + mt_defs, mt_defs_ext - defines variables for test framework .SH SYNOPSIS + .B #include <mtest.h> .sp .B mt_defs() @@ -12,24 +14,25 @@ mt_defs, mt_defs_ext - defines variables for test framework .sp .SH DESCRIPTION -\fBmt_defs\fR() defines all variables needed by the test framework. This must + +\fBmt_defs\fR(3) defines all variables needed by the test framework. This must be called exactly once in a global scope, before calling any of the \fBmtest\fR function. Calling this macro in two places will lead to 'double definition' linker error. As a rule of thumb, it is good to call this macro in test-main.c file after #includes. -If all tests are in a single file (like test-main.c) calling \fBmt_defs\fR() +If all tests are in a single file (like test-main.c) calling \fBmt_defs\fR(3) is sufficient, but if tests are splitted into more .c files, you should also -call \fBmt_defs_ext\fR() in all .c files that uses \fBmtest\fR functions. As -with \fBmt_defs\fR(), it should be called before any call to \fBmtest\fR +call \fBmt_defs_ext\fR(3) in all .c files that uses \fBmtest\fR functions. As +with \fBmt_defs\fR(3), it should be called before any call to \fBmtest\fR function. -Note, don't call \fBmt_defs_ext\fR() if \fBmt_defs\fR() has already been called -in a single file. +Note, don't call \fBmt_defs_ext\fR(3) if \fBmt_defs\fR(3) has already been +called in a single file. .SH EXAMPLE + .nf -.TP /* test-main.c */ #include <mtest.h> @@ -54,7 +57,7 @@ int main(void) mt_return(); } -.TP + /* t1.c */ #include <mtest.h> @@ -69,7 +72,7 @@ void test_one(void) mt_assert(bar() == 0); } -.TP + /* t2.c */ #include <mtest.h> @@ -97,9 +100,12 @@ void test_group(void) .fi .SH "SEE ALSO" + .BR mt_run (3), +.BR mt_run_named (3), .BR mt_assert (3), .BR mt_fail (3), .BR mt_fok (3), .BR mt_ferr (3), .BR mt_return (3) +.BR mtest_overview (7) diff --git a/mt_defs_ext.3 b/man/man3/mt_defs_ext.3 index 2a574c6..2a574c6 100644 --- a/mt_defs_ext.3 +++ b/man/man3/mt_defs_ext.3 diff --git a/mt_fail.3 b/man/man3/mt_fail.3 index 9be3e5e..9be3e5e 100644 --- a/mt_fail.3 +++ b/man/man3/mt_fail.3 diff --git a/mt_ferr.3 b/man/man3/mt_ferr.3 index d2ba116..d2ba116 100644 --- a/mt_ferr.3 +++ b/man/man3/mt_ferr.3 diff --git a/mt_fok.3 b/man/man3/mt_fok.3 index 70df794..99d4f88 100644 --- a/mt_fok.3 +++ b/man/man3/mt_fok.3 @@ -1,9 +1,11 @@ -.TH "MT_FOK" "3" "15 January 2018 (v1.1.0)" "bofc.pl" +.TH "MT_FOK" "3" "17 January 2018 (v1.1.0)" "bofc.pl" .SH NAME + mt_fok, mt_ferr - shortcut macro to test if function executed as expected. .SH SYNOPSIS + .B #include <mtest.h> .sp .BI "mt_fok(" function_call ")" @@ -12,14 +14,15 @@ mt_fok, mt_ferr - shortcut macro to test if function executed as expected. .sp .SH DESCRIPTION + Macros are a simple shortcuts to perform test on functions that return either -1 or 0. By convention 0 means success and -1 means error and error reason is stored in \fBerrno\fR variable. If function returns different values than 0 -or -1, ordinary \fBmt_fail\fR() should be used instead. +or -1, ordinary \fBmt_fail\fR(3) should be used instead. -\fBmt_fok\fR simply expects that function returns 0. +\fBmt_fok\fR(3) simply expects that function returns 0. -\fBmt_ferr\fR expects function to return -1, and sets \fBerrno\fR value to +\fBmt_ferr\fR(3) expects function to return -1, and sets \fBerrno\fR value to \fIerrno_value\fR. Both functions uses \fBmt_fail\fR(3) under the hood. @@ -57,10 +60,12 @@ int main(void) .fi .SH "SEE ALSO" -.BR mtest_overview (3), + .BR mt_defs (3), .BR mt_defs_ext (3), .BR mt_run (3), +.BR mt_run_named (3), .BR mt_assert (3), .BR mt_fail (3), .BR mt_return (3) +.BR mtest_overview (7), diff --git a/mt_return.3 b/man/man3/mt_return.3 index 8535642..ff442b6 100644 --- a/mt_return.3 +++ b/man/man3/mt_return.3 @@ -1,6 +1,7 @@ -.TH "MT_RETURN" "3" "15 January 2018 (v1.1.0)" "bofc.pl" +.TH "MT_RETURN" "3" "17 January 2018 (v1.1.0)" "bofc.pl" .SH NAME + mt_return - finishes test execution .SH SYNOPSIS @@ -17,7 +18,8 @@ shell .BI mt_return .SH DESCRIPTION -\fBmt_return\fR() should be called once at the very end of \fBmain\fR() + +\fBmt_return\fR(3) should be called once at the very end of \fBmain\fR() function. In other words, this macro should be called in \fBmain\fR() instead of normal return. Function will print number of tests executed and will exit test program. Returned value is number of tests that have failed, so if return code @@ -31,9 +33,11 @@ In shell call this function at the very end of shell script. Proper example can be found in \fBmtest_overview\fR(7). .SH "SEE ALSO" + .BR mt_defs (3), .BR mt_defs_ext (3), .BR mt_run (3), +.BR mt_run (3), .BR mt_assert (3), .BR mt_fail (3), .BR mt_fok (3), diff --git a/mt_run.3 b/man/man3/mt_run.3 index 7962b84..a1c7d2d 100644 --- a/mt_run.3 +++ b/man/man3/mt_run.3 @@ -1,11 +1,13 @@ -.TH "MT_RUN" "3" "15 January 2018 (v1.1.0)" "bofc.pl" +.TH "MT_RUN" "3" "17 January 2018 (v1.1.0)" "bofc.pl" .SH NAME + mt_run - runs specific test c/c++ .SH SYNOPSIS + .B #include <mtest.h> .sp .BI "void (*" function_name ")(void) @@ -25,13 +27,14 @@ shell .BI "mt_run <" function_name ">" .SH DESCRIPTION -\fBmt_run\fR() runs a single test specified in \fIfunction_name\fR. Inside -function you can call \fBmt_assert\fR() and \fBmt_fail\fR(). If none if these + +\fBmt_run\fR(#) runs a single test specified in \fIfunction_name\fR. Inside +function you can call \fBmt_assert\fR(3) and \fBmt_fail\fR(3). If none if these functions is called inside test function, \fBmtest\fR will mark test as -successful. After function finishes its work, \fBmt_run\fR() will print test +successful. After function finishes its work, \fBmt_run\fR(3) will print test status and a \fIfunction_name\fR to know which test passed or failed. -\fBmt_run_named\fR() works similar, but also takes \fItest_name\fR, that will +\fBmt_run_named\fR(3) works similar, but also takes \fItest_name\fR, that will be printed instead of \fIfunction_name\fR when reporting test results. \fItest_name\fR should be simple \fBconst char *\fR. @@ -48,7 +51,6 @@ then automatically c/c++ .nf - #include <mtest.h> #include "foo.h" @@ -67,13 +69,11 @@ int main(void) mt_return(); } - .fi shell .nf - #!/bin/sh . ./mtest.sh @@ -87,10 +87,10 @@ test_one() mt_run test_one mt_return - .fi .SH "SEE ALSO" + .BR mt_defs (3), .BR mt_defs_ext (3), .BR mt_assert (3), @@ -98,3 +98,4 @@ mt_return .BR mt_fok (3), .BR mt_ferr (3), .BR mt_return (3) +.BR mtest_overview (7), diff --git a/mt_run_named.3 b/man/man3/mt_run_named.3 index 7c9fe17..7c9fe17 100644 --- a/mt_run_named.3 +++ b/man/man3/mt_run_named.3 diff --git a/mtest_overview.7 b/man/man7/mtest_overview.7 index 992ef5a..6705c2a 100644 --- a/mtest_overview.7 +++ b/man/man7/mtest_overview.7 @@ -1,9 +1,11 @@ -.TH "MTEST" "7" "15 January 2018 (v1.1.0)" "bofc.pl" +.TH "MTEST" "7" "17 January 2018 (v1.1.0)" "bofc.pl" .SH "NAME" + \fBmtest_overview\fR - overview of \fBmtest\fR testing framework .SH "DESCRIPTION" + \fBmtest\fR - very simple test framework for testing anything. mtest currently supports following languages: @@ -43,10 +45,10 @@ Test output is compatible with \fBTAP\fR (which stands for Test Anything Protocol), so its output can be piped to another tool (like Jenkins or automake tests) for nice output. -Each test binary (written in c/c++) should contain call to \fBmt_defs()\fR -anywhere in a global scope and \fBmt_return()\fR at the end of tests. +Each test binary (written in c/c++) should contain call to \fBmt_defs\fR(3) +anywhere in a global scope and \fBmt_return\fR(3) at the end of tests. -Tests in shell only requires \fBmt_return\fR at the end of tests +Tests in shell only requires \fBmt_return\fR(3) at the end of tests .SH "EXAMPLE" @@ -88,7 +90,7 @@ Example of using mt in posix shell .nf #!/bin/sh -. ./mtest.sh +\&. ./mtest.sh test_one() { @@ -102,6 +104,7 @@ mt_return .fi .SH "SEE ALSO" + .BR mt_defs (3), .BR mt_defs_ext (3), .BR mt_run (3), |