Core Codec API Unit Tests.
More...
Go to the source code of this file.
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Core codec 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 ast_codec | audio_get |
|
static struct ast_codec | audio_get_id |
|
static struct ast_codec | audio_get_unknown |
|
static struct ast_codec | audio_without_rate |
|
static struct ast_codec | doubly |
|
static struct ast_codec | known_unknown |
|
static struct ast_codec | unknown |
|
Core Codec API Unit Tests.
- Author
- Joshua Colp jcolp.nosp@m.@dig.nosp@m.ium.c.nosp@m.om
Definition in file test_core_codec.c.
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ AST_TEST_DEFINE() [1/8]
AST_TEST_DEFINE |
( |
codec_register |
| ) |
|
◆ AST_TEST_DEFINE() [2/8]
AST_TEST_DEFINE |
( |
codec_register_twice |
| ) |
|
◆ AST_TEST_DEFINE() [3/8]
AST_TEST_DEFINE |
( |
codec_register_unknown |
| ) |
|
◆ AST_TEST_DEFINE() [4/8]
AST_TEST_DEFINE |
( |
codec_register_audio_no_sample_rate |
| ) |
|
◆ AST_TEST_DEFINE() [5/8]
AST_TEST_DEFINE |
( |
codec_get |
| ) |
|
Definition at line 200 of file test_core_codec.c.
References ao2_cleanup, ast_codec_get(), ast_codec_register, AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, sip_to_pjsip::info(), ast_codec::name, NULL, RAII_VAR, ast_codec::sample_rate, TEST_EXECUTE, TEST_INIT, and ast_codec::type.
206 info->name =
"codec_get";
207 info->category =
"/main/core_codec/";
208 info->summary =
"codec get unit test";
210 "Test that getting of a known codec succeeds";
const char * name
Name for this codec.
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
#define ast_codec_register(codec)
This function is used to register a codec with the Asterisk core. Registering allows it to be passed ...
unsigned int sample_rate
Sample rate (number of samples carried in a second)
enum ast_media_type type
Type of media this codec contains.
static struct ast_codec audio_get
Represents a media codec within Asterisk.
◆ AST_TEST_DEFINE() [6/8]
AST_TEST_DEFINE |
( |
codec_get_unregistered |
| ) |
|
Definition at line 239 of file test_core_codec.c.
References ao2_cleanup, ast_codec_get(), AST_MEDIA_TYPE_AUDIO, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, sip_to_pjsip::info(), test::name, NULL, RAII_VAR, TEST_EXECUTE, and TEST_INIT.
245 info->name =
"codec_get_unregistered";
246 info->category =
"/main/core_codec/";
247 info->summary =
"codec get unit test";
249 "Test that getting of a codec that is not registered fails";
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
Represents a media codec within Asterisk.
◆ AST_TEST_DEFINE() [7/8]
AST_TEST_DEFINE |
( |
codec_get_unknown |
| ) |
|
Definition at line 265 of file test_core_codec.c.
References ao2_cleanup, ast_codec_get(), ast_codec_register, AST_MEDIA_TYPE_UNKNOWN, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, sip_to_pjsip::info(), ast_codec::name, NULL, RAII_VAR, ast_codec::sample_rate, TEST_EXECUTE, TEST_INIT, and ast_codec::type.
271 info->name =
"codec_get_unknown";
272 info->category =
"/main/core_codec/";
273 info->summary =
"codec get unit test";
275 "Test that getting of a known codec using name and unknown type succeeds";
const char * name
Name for this codec.
static struct ast_codec audio_get_unknown
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
#define ast_codec_register(codec)
This function is used to register a codec with the Asterisk core. Registering allows it to be passed ...
unsigned int sample_rate
Sample rate (number of samples carried in a second)
enum ast_media_type type
Type of media this codec contains.
Represents a media codec within Asterisk.
◆ AST_TEST_DEFINE() [8/8]
AST_TEST_DEFINE |
( |
codec_get_id |
| ) |
|
Definition at line 304 of file test_core_codec.c.
References ao2_cleanup, ast_codec_get(), ast_codec_get_by_id(), ast_codec_register, 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_EXECUTE, and TEST_INIT.
311 info->name =
"codec_get_unknown";
312 info->category =
"/main/core_codec/";
313 info->summary =
"codec get unit test";
315 "Test that getting of a known codec using name and unknown type succeeds";
struct ast_codec * ast_codec_get_by_id(int id)
Retrieve a codec given the unique identifier.
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
#define ast_codec_register(codec)
This function is used to register a codec with the Asterisk core. Registering allows it to be passed ...
static struct ast_codec audio_get_id
Represents a media codec within Asterisk.
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Core codec 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 |
◆ ast_module_info
◆ audio_get
◆ audio_get_id
◆ audio_get_unknown
◆ audio_without_rate
◆ doubly
◆ known_unknown
◆ unknown