Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Core Format API Unit Tests. More...
#include "asterisk.h"
#include "asterisk/test.h"
#include "asterisk/module.h"
#include "asterisk/codec.h"
#include "asterisk/format.h"
Go to the source code of this file.
Data Structures | |
struct | callbacks_called |
Tracking object used to verify format attribute callbacks. More... | |
struct | test_core_format_pvt |
A test piece of data to associate with test_core_format_attr. More... | |
Macros | |
#define | TEST_CATEGORY "/main/core_format/" |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (format_attr_cmp_same_codec) | |
AST_TEST_DEFINE (format_attr_joint_same_codec) | |
AST_TEST_DEFINE (format_attribute_get_without_interface) | |
AST_TEST_DEFINE (format_attribute_set_without_interface) | |
AST_TEST_DEFINE (format_clone) | |
AST_TEST_DEFINE (format_cmp_different_codec) | |
AST_TEST_DEFINE (format_cmp_same_codec) | |
AST_TEST_DEFINE (format_copy) | |
AST_TEST_DEFINE (format_create) | |
AST_TEST_DEFINE (format_create_attr) | |
AST_TEST_DEFINE (format_joint_different_codec) | |
AST_TEST_DEFINE (format_joint_same_codec) | |
AST_TEST_DEFINE (format_parse_and_generate_sdp_fmtp) | |
AST_TEST_DEFINE (format_parse_sdp_fmtp_without_interface) | |
AST_TEST_DEFINE (format_retrieve_attr) | |
static int | load_module (void) |
static const void * | test_core_format_attribute_get (const struct ast_format *format, const char *name) |
Format attribute callback for retrieving an attribute. More... | |
static struct ast_format * | test_core_format_attribute_set (const struct ast_format *format, const char *name, const char *value) |
Format attribute callback for setting an attribute on a format. More... | |
static int | test_core_format_clone (const struct ast_format *src, struct ast_format *dst) |
Format attribute callback called during format cloning. More... | |
static enum ast_format_cmp_res | test_core_format_cmp (const struct ast_format *format1, const struct ast_format *format2) |
Format attribute callback called during format comparison. More... | |
static void | test_core_format_destroy (struct ast_format *format) |
Format attribute callback for when format attributes are to be destroyed. More... | |
static void | test_core_format_generate_sdp_fmtp (const struct ast_format *format, unsigned int payload, struct ast_str **str) |
Format attribute callback to generate an SDP fmtp line from a format. More... | |
static struct ast_format * | test_core_format_get_joint (const struct ast_format *format1, const struct ast_format *format2) |
Format attribute callback called during joint format capability. More... | |
static int | test_core_format_init (struct ast_test_info *info, struct ast_test *test) |
static struct ast_format * | test_core_format_parse_sdp_fmtp (const struct ast_format *format, const char *attributes) |
Format attribute callback to construct a format from an SDP fmtp line. More... | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Core format API test module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct callbacks_called | test_callbacks_called |
A global tracking object. Cleared out by the test init cb. More... | |
static struct ast_format_interface | test_core_format_attr |
A format attribute 'module' used by the unit tests. More... | |
static struct ast_codec | test_core_format_codec |
A test codec for these unit tests. Should be used with test_core_format . More... | |
Core Format API Unit Tests.
Definition in file test_core_format.c.
#define TEST_CATEGORY "/main/core_format/" |
Definition at line 39 of file test_core_format.c.
|
static |
Definition at line 1081 of file test_core_format.c.
|
static |
Definition at line 1081 of file test_core_format.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1081 of file test_core_format.c.
AST_TEST_DEFINE | ( | format_attr_cmp_same_codec | ) |
Definition at line 587 of file test_core_format.c.
References ao2_cleanup, ao2_ref, ast_codec_get(), ast_format_attribute_set(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_create(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, first, callbacks_called::format_attribute_set, callbacks_called::format_cmp, sip_to_pjsip::info(), NULL, RAII_VAR, test_callbacks_called, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_attr_joint_same_codec | ) |
Definition at line 698 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_attribute_set(), ast_format_create(), ast_format_generate_sdp_fmtp(), ast_format_get_codec_id(), ast_format_joint(), AST_MEDIA_TYPE_AUDIO, ast_str_alloca, ast_str_buffer(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, first, callbacks_called::format_attribute_set, callbacks_called::format_generate_sdp_fmtp, callbacks_called::format_get_joint, sip_to_pjsip::info(), NULL, RAII_VAR, test_callbacks_called, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_attribute_get_without_interface | ) |
Definition at line 897 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_attribute_get(), ast_format_create(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_format::codec, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_attribute_set_without_interface | ) |
Definition at line 857 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_attribute_set(), ast_format_create(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_format::codec, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_clone | ) |
Definition at line 398 of file test_core_format.c.
References ao2_cleanup, ao2_ref, ast_codec_get(), ast_format_attribute_set(), ast_format_clone(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_create(), ast_format_get_codec_id(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, callbacks_called::format_attribute_set, callbacks_called::format_clone, callbacks_called::format_cmp, sip_to_pjsip::info(), NULL, RAII_VAR, test_callbacks_called, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_cmp_different_codec | ) |
Definition at line 536 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_create(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, first, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_cmp_same_codec | ) |
Definition at line 480 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_create(), ast_format_create_named(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, first, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_copy | ) |
Definition at line 815 of file test_core_format.c.
References ao2_bump, ao2_cleanup, ast_codec_get(), ast_format_create(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, copy(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_create | ) |
Definition at line 253 of file test_core_format.c.
References ao2_cleanup, ao2_ref, ast_codec_get(), ast_format_create(), ast_format_create_named(), ast_format_get_codec_id(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_create_attr | ) |
Definition at line 298 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_attribute_set(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_create(), ast_format_get_codec_id(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, callbacks_called::format_attribute_set, callbacks_called::format_cmp, sip_to_pjsip::info(), NULL, RAII_VAR, test_callbacks_called, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_joint_different_codec | ) |
Definition at line 762 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_create(), ast_format_joint(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, first, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_joint_same_codec | ) |
Definition at line 649 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_create(), ast_format_get_codec_id(), ast_format_joint(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, first, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_parse_and_generate_sdp_fmtp | ) |
Definition at line 973 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_create(), ast_format_generate_sdp_fmtp(), ast_format_parse_sdp_fmtp(), AST_MEDIA_TYPE_AUDIO, ast_str_alloca, ast_str_buffer(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_format::codec, callbacks_called::format_generate_sdp_fmtp, callbacks_called::format_parse_sdp_fmtp, sip_to_pjsip::info(), NULL, RAII_VAR, test_callbacks_called, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_parse_sdp_fmtp_without_interface | ) |
Definition at line 934 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_create(), ast_format_parse_sdp_fmtp(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, ast_format::codec, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | format_retrieve_attr | ) |
Definition at line 349 of file test_core_format.c.
References ao2_cleanup, ast_codec_get(), ast_format_attribute_get(), ast_format_attribute_set(), ast_format_create(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_CATEGORY, TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 1047 of file test_core_format.c.
References ast_codec_register, ast_format_interface_register, ast_log, AST_LOG_ERROR, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, TEST_CATEGORY, test_core_format_attr, test_core_format_codec, and test_core_format_init().
|
static |
Format attribute callback for retrieving an attribute.
Definition at line 206 of file test_core_format.c.
References ast_format_get_attribute_data(), test_core_format_pvt::field_one, test_core_format_pvt::field_two, name, and NULL.
|
static |
Format attribute callback for setting an attribute on a format.
Definition at line 185 of file test_core_format.c.
References ast_format_clone(), ast_format_get_attribute_data(), test_core_format_pvt::field_one, test_core_format_pvt::field_two, callbacks_called::format_attribute_set, name, NULL, test_callbacks_called, and value.
|
static |
Format attribute callback called during format cloning.
Definition at line 112 of file test_core_format.c.
References ast_calloc, ast_format_get_attribute_data(), ast_format_set_attribute_data(), callbacks_called::format_clone, and test_callbacks_called.
|
static |
Format attribute callback called during format comparison.
Definition at line 133 of file test_core_format.c.
References AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_attribute_data(), test_core_format_pvt::field_one, test_core_format_pvt::field_two, callbacks_called::format_cmp, and test_callbacks_called.
|
static |
Format attribute callback for when format attributes are to be destroyed.
Definition at line 103 of file test_core_format.c.
References ast_format_get_attribute_data(), ast_free, callbacks_called::format_destroy, and test_callbacks_called.
|
static |
Format attribute callback to generate an SDP fmtp line from a format.
Definition at line 240 of file test_core_format.c.
References ast_format_get_attribute_data(), ast_str_append(), test_core_format_pvt::field_one, test_core_format_pvt::field_two, callbacks_called::format_generate_sdp_fmtp, str, and test_callbacks_called.
|
static |
Format attribute callback called during joint format capability.
field_one
and field_two
Definition at line 163 of file test_core_format.c.
References ast_format_clone(), ast_format_get_attribute_data(), test_core_format_pvt::field_one, test_core_format_pvt::field_two, callbacks_called::format_get_joint, MAX, NULL, and test_callbacks_called.
|
static |
Definition at line 1019 of file test_core_format.c.
References test_callbacks_called.
Referenced by load_module().
|
static |
Format attribute callback to construct a format from an SDP fmtp line.
Definition at line 219 of file test_core_format.c.
References ao2_ref, ast_format_clone(), ast_format_get_attribute_data(), test_core_format_pvt::field_one, test_core_format_pvt::field_two, callbacks_called::format_parse_sdp_fmtp, NULL, and test_callbacks_called.
|
static |
Definition at line 1026 of file test_core_format.c.
References AST_TEST_UNREGISTER.
|
static |
Definition at line 1081 of file test_core_format.c.
|
static |
Definition at line 1081 of file test_core_format.c.
|
static |
A global tracking object. Cleared out by the test init cb.
Definition at line 100 of file test_core_format.c.
Referenced by AST_TEST_DEFINE(), test_core_format_attribute_set(), test_core_format_clone(), test_core_format_cmp(), test_core_format_destroy(), test_core_format_generate_sdp_fmtp(), test_core_format_get_joint(), test_core_format_init(), and test_core_format_parse_sdp_fmtp().
|
static |
A format attribute 'module' used by the unit tests.
Definition at line 51 of file test_core_format.c.
Referenced by load_module().
|
static |
A test codec for these unit tests. Should be used with test_core_format
.
Definition at line 71 of file test_core_format.c.
Referenced by load_module().