URI 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 = "URI 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 const char * | scenarios [][7] |
|
◆ CATEGORY
#define CATEGORY "/main/uri/" |
◆ VALIDATE
#define VALIDATE |
( |
|
value, |
|
|
|
expected_value |
|
) |
| |
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ AST_TEST_DEFINE() [1/3]
AST_TEST_DEFINE |
( |
uri_parse |
| ) |
|
Definition at line 51 of file test_uri.c.
References ao2_cleanup, ARRAY_LEN, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_uri_host(), ast_uri_parse(), ast_uri_path(), ast_uri_port(), ast_uri_query(), ast_uri_scheme(), ast_uri_user_info(), CATEGORY, sip_to_pjsip::info(), NULL, RAII_VAR, scenarios, TEST_EXECUTE, TEST_INIT, and VALIDATE.
53 #define VALIDATE(value, expected_value) \ 54 do { ast_test_validate(test, \ 55 (value == expected_value) || \ 56 (value && expected_value && \ 57 !strcmp(value, expected_value))); \ 64 info->name = __func__;
66 info->summary =
"Uri parsing scenarios";
67 info->description =
"For each scenario validate result(s)";
const char * ast_uri_path(const struct ast_uri *uri)
Retrieve the uri path.
Stores parsed uri information.
struct ast_uri * ast_uri_parse(const char *uri)
Parse the given uri into a structure.
#define VALIDATE(value, expected_value)
const char * ast_uri_query(const struct ast_uri *uri)
Retrieve the uri query parameters.
const char * ast_uri_user_info(const struct ast_uri *uri)
Retrieve the uri user information.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
const char * ast_uri_port(const struct ast_uri *uri)
Retrieve the uri port.
static const char * scenarios[][7]
const char * ast_uri_scheme(const struct ast_uri *uri)
Retrieve the uri scheme.
const char * ast_uri_host(const struct ast_uri *uri)
Retrieve the uri host.
◆ AST_TEST_DEFINE() [2/3]
AST_TEST_DEFINE |
( |
uri_default_http |
| ) |
|
Definition at line 88 of file test_uri.c.
References ao2_cleanup, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_uri_host(), ast_uri_is_secure(), ast_uri_parse_http(), ast_uri_port(), ast_uri_scheme(), CATEGORY, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, and TEST_INIT.
94 info->name = __func__;
96 info->summary =
"parse an http uri with host only";
Stores parsed uri information.
struct ast_uri * ast_uri_parse_http(const char *uri)
Parse the given http uri into a structure.
int attribute_pure ast_uri_is_secure(const struct ast_uri *uri)
Retrieve if the uri is of a secure type.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
const char * ast_uri_port(const struct ast_uri *uri)
Retrieve the uri port.
const char * ast_uri_scheme(const struct ast_uri *uri)
Retrieve the uri scheme.
const char * ast_uri_host(const struct ast_uri *uri)
Retrieve the uri host.
◆ AST_TEST_DEFINE() [3/3]
AST_TEST_DEFINE |
( |
uri_default_http_secure |
| ) |
|
Definition at line 112 of file test_uri.c.
References ao2_cleanup, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_uri_host(), ast_uri_is_secure(), ast_uri_parse_http(), ast_uri_port(), ast_uri_scheme(), CATEGORY, sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, and TEST_INIT.
118 info->name = __func__;
120 info->summary =
"parse an https uri with host only";
Stores parsed uri information.
struct ast_uri * ast_uri_parse_http(const char *uri)
Parse the given http uri into a structure.
int attribute_pure ast_uri_is_secure(const struct ast_uri *uri)
Retrieve if the uri is of a secure type.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
const char * ast_uri_port(const struct ast_uri *uri)
Retrieve the uri port.
const char * ast_uri_scheme(const struct ast_uri *uri)
Retrieve the uri scheme.
const char * ast_uri_host(const struct ast_uri *uri)
Retrieve the uri host.
◆ 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 = "URI 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
◆ scenarios
const char* scenarios[][7] |
|
static |