This patch fixes a number of errors and warning messages in the doxygen log. Specifically, it addresses: * A number of files incorrectly places a '\brief' tag immediately after a '\file' tag. Doing so emits a warning, as '\file' takes an optional argument specifying which file the doxygen comment is for. As '\brief' is not a file, doxygen was unamused. * A grouping of Stasis Topics and Messages in rtp_engine.h was incorrectly terminated. We now correctly terminate the grouping, which prevents members of rtp_engine.h from showing up in the wrong group. * Group indicators which are not part of the Stasis Topics and Messages group were removed. Group indicators without an \addtogroup or \ingroup have no meaning. Change-Id: Ia1415ffec6767e27233ae1cae5ed5970de5656d4
189 lines
4 KiB
C
189 lines
4 KiB
C
/*
|
|
* Asterisk -- An open source telephony toolkit.
|
|
*
|
|
* Copyright (C) 2013, Digium, Inc.
|
|
*
|
|
* David M. Lee, II <dlee@digium.com>
|
|
*
|
|
* See http://www.asterisk.org for more information about
|
|
* the Asterisk project. Please do not directly contact
|
|
* any of the maintainers of this project for assistance;
|
|
* the project provides a web site, mailing lists and IRC
|
|
* channels for your use.
|
|
*
|
|
* This program is free software, distributed under the terms of
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
* at the top of the source tree.
|
|
*/
|
|
|
|
/*!
|
|
* \file
|
|
* \brief Test optional API.
|
|
*
|
|
* This tests exercise the underlying implementation functions. Acutal usage
|
|
* won't look anything like this; it would use the wrapper macros.
|
|
*
|
|
* \author\verbatim David M. Lee, II <dlee@digium.com> \endverbatim
|
|
*
|
|
* \ingroup tests
|
|
*/
|
|
|
|
/*** MODULEINFO
|
|
<depend>TEST_FRAMEWORK</depend>
|
|
<depend>OPTIONAL_API</depend>
|
|
<support_level>core</support_level>
|
|
***/
|
|
|
|
#include "asterisk.h"
|
|
|
|
ASTERISK_REGISTER_FILE()
|
|
|
|
#include "asterisk/module.h"
|
|
#include "asterisk/optional_api.h"
|
|
#include "asterisk/test.h"
|
|
|
|
#define CATEGORY "/main/optional_api/"
|
|
|
|
enum was_called {
|
|
NONE,
|
|
STUB,
|
|
IMPL
|
|
};
|
|
|
|
enum was_called was_called_result;
|
|
|
|
ast_optional_fn test_optional_ref;
|
|
|
|
static void test_optional_stub(void)
|
|
{
|
|
was_called_result = STUB;
|
|
}
|
|
|
|
static void test_optional_impl(void)
|
|
{
|
|
was_called_result = IMPL;
|
|
}
|
|
|
|
static void test_optional(void)
|
|
{
|
|
was_called_result = NONE;
|
|
if (test_optional_ref) {
|
|
test_optional_ref();
|
|
}
|
|
}
|
|
|
|
#define SYMNAME "test_option"
|
|
|
|
AST_TEST_DEFINE(test_provide_first)
|
|
{
|
|
enum ast_test_result_state res;
|
|
|
|
switch (cmd) {
|
|
case TEST_INIT:
|
|
info->name = __func__;
|
|
info->category = CATEGORY;
|
|
info->summary = "Test optional API publishing.";
|
|
info->description = "Test optional API publishing.";
|
|
return AST_TEST_NOT_RUN;
|
|
case TEST_EXECUTE:
|
|
break;
|
|
}
|
|
|
|
res = AST_TEST_FAIL;
|
|
test_optional_ref = 0;
|
|
|
|
ast_optional_api_provide(SYMNAME, test_optional_impl);
|
|
|
|
ast_optional_api_use(SYMNAME, &test_optional_ref, test_optional_stub,
|
|
AST_MODULE);
|
|
|
|
test_optional();
|
|
|
|
if (was_called_result != IMPL) {
|
|
ast_test_status_update(test, "Expected %d, was %u",
|
|
IMPL, was_called_result);
|
|
goto done;
|
|
}
|
|
|
|
res = AST_TEST_PASS;
|
|
|
|
done:
|
|
ast_optional_api_unuse(SYMNAME, &test_optional_ref, AST_MODULE);
|
|
ast_optional_api_unprovide(SYMNAME, test_optional_impl);
|
|
return res;
|
|
}
|
|
|
|
AST_TEST_DEFINE(test_provide_last)
|
|
{
|
|
enum ast_test_result_state res;
|
|
|
|
switch (cmd) {
|
|
case TEST_INIT:
|
|
info->name = __func__;
|
|
info->category = CATEGORY;
|
|
info->summary = "Test optional API publishing.";
|
|
info->description = "Test optional API publishing.";
|
|
return AST_TEST_NOT_RUN;
|
|
case TEST_EXECUTE:
|
|
break;
|
|
}
|
|
|
|
res = AST_TEST_FAIL;
|
|
test_optional_ref = 0;
|
|
|
|
ast_optional_api_use(SYMNAME, &test_optional_ref, test_optional_stub,
|
|
AST_MODULE);
|
|
|
|
test_optional();
|
|
if (was_called_result != STUB) {
|
|
ast_test_status_update(test, "Expected %d, was %u",
|
|
STUB, was_called_result);
|
|
goto done;
|
|
}
|
|
|
|
ast_optional_api_provide(SYMNAME, test_optional_impl);
|
|
|
|
test_optional();
|
|
if (was_called_result != IMPL) {
|
|
ast_test_status_update(test, "Expected %d, was %u",
|
|
IMPL, was_called_result);
|
|
ast_optional_api_unprovide(SYMNAME, test_optional_impl);
|
|
goto done;
|
|
}
|
|
|
|
ast_optional_api_unprovide(SYMNAME, test_optional_impl);
|
|
|
|
test_optional();
|
|
if (was_called_result != STUB) {
|
|
ast_test_status_update(test, "Expected %d, was %u",
|
|
STUB, was_called_result);
|
|
ast_optional_api_unprovide(SYMNAME, test_optional_impl);
|
|
goto done;
|
|
}
|
|
|
|
res = AST_TEST_PASS;
|
|
|
|
done:
|
|
ast_optional_api_unuse(SYMNAME, &test_optional_ref, AST_MODULE);
|
|
return res;
|
|
}
|
|
|
|
static int unload_module(void)
|
|
{
|
|
AST_TEST_UNREGISTER(test_provide_first);
|
|
AST_TEST_UNREGISTER(test_provide_last);
|
|
return 0;
|
|
}
|
|
|
|
static int load_module(void)
|
|
{
|
|
AST_TEST_REGISTER(test_provide_first);
|
|
AST_TEST_REGISTER(test_provide_last);
|
|
return AST_MODULE_LOAD_SUCCESS;
|
|
}
|
|
|
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ARI testing",
|
|
.load = load_module,
|
|
.unload = unload_module,
|
|
);
|