[asterisk-commits] dvossel: branch dvossel/test_api r235177 - in /team/dvossel/test_api: include...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 15 14:20:30 CST 2009
Author: dvossel
Date: Tue Dec 15 14:20:29 2009
New Revision: 235177
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235177
Log:
AST_TEST_DEFINE documentation further updated
static helper functions called only by a defined test
function must also be wrapped in a #ifdef TEST_FRAMEWORK
if they are not called by any other non-test related
functions
Modified:
team/dvossel/test_api/include/asterisk/test.h
team/dvossel/test_api/tests/test_heap.c
Modified: team/dvossel/test_api/include/asterisk/test.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/test_api/include/asterisk/test.h?view=diff&rev=235177&r1=235176&r2=235177
==============================================================================
--- team/dvossel/test_api/include/asterisk/test.h (original)
+++ team/dvossel/test_api/include/asterisk/test.h Tue Dec 15 14:20:29 2009
@@ -28,7 +28,7 @@
using the AST_TEST_DEFINE macro.
AST_TEST_DEFINE(sample_test_cb, \\The first argument is the name of the callback function
-{ \\The second argument is the function's body
+{ \\* The second argument is the function's body
\test code
.
.
@@ -36,15 +36,17 @@
return res ? AST_RESULT_FAIL : AST_RESULT_PASS;
})
-NOTE: It is possible for a ',' within the code body to mess up the macro
-depending on how it is used. If this happens (code won't compile) and can
-not be avoided, a separate static function must be created to hold
-the test's code. In this case the callback's message body should just contain
-a call to the static function.
-
Every callback function is passed a string buffer which allows
the function to provide an optional short description of
what went wrong if the test failed.
+
+*NOTE: It is possible for a ',' within the code body to mess up the macro
+depending on how it is used. If this happens (it will be obvious because
+code won't compile) and can not be avoided, a separate static function must
+be created to hold the test's code. In this case the callback's message body
+should just contain a call to the static function. Any supporting static
+functions must be wrapped by an '#ifdef TEST_FRAMEWORK' block if they are
+not also called by another none test defined function.
2. REGISTER TEST: Register the test using the AST_TEST_REGISTER macro.
Modified: team/dvossel/test_api/tests/test_heap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/test_api/tests/test_heap.c?view=diff&rev=235177&r1=235176&r2=235177
==============================================================================
--- team/dvossel/test_api/tests/test_heap.c (original)
+++ team/dvossel/test_api/tests/test_heap.c Tue Dec 15 14:20:29 2009
@@ -36,6 +36,7 @@
#include "asterisk/heap.h"
#include "asterisk/test.h"
+#ifdef TEST_FRAMEWORK
struct node {
long val;
size_t index;
@@ -54,6 +55,7 @@
return 1;
}
}
+#endif
AST_TEST_DEFINE(heap_test_1,
{
More information about the asterisk-commits
mailing list