Asterisk - The Open Source Telephony Project GIT-master-754dea3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Functions
test.c File Reference

Unit Test Framework. More...

#include "asterisk.h"
#include "asterisk/_private.h"
Include dependency graph for test.c:

Go to the source code of this file.

Functions

int ast_test_init (void)
 

Detailed Description

Unit Test Framework.

Author
David Vossel dvoss.nosp@m.el@d.nosp@m.igium.nosp@m..com
Russell Bryant russe.nosp@m.ll@d.nosp@m.igium.nosp@m..com

Definition in file test.c.

Function Documentation

◆ ast_test_init()

int ast_test_init ( void  )

Provided by test.c

Definition at line 1505 of file test.c.

1506{
1507#ifdef TEST_FRAMEWORK
1508 ast_register_cleanup(test_cleanup);
1509
1510 /* Create stasis topic */
1511 test_suite_topic = stasis_topic_create("testsuite:all");
1512 if (!test_suite_topic) {
1513 return -1;
1514 }
1515
1516 if (STASIS_MESSAGE_TYPE_INIT(ast_test_suite_message_type) != 0) {
1517 return -1;
1518 }
1519
1520 AST_TEST_REGISTER(test_registrations);
1521
1522 /* Register cli commands */
1523 ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli));
1524#endif
1525
1526 return 0;
1527}
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
Definition: stasis.c:644
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Definition: stasis.h:1493
#define AST_TEST_REGISTER(cb)
Definition: test.h:127
#define ARRAY_LEN(a)
Definition: utils.h:666

References ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), AST_TEST_REGISTER, STASIS_MESSAGE_TYPE_INIT, and stasis_topic_create().

Referenced by asterisk_daemon().