Asterisk - The Open Source Telephony Project GIT-master-7e7a603
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 1482 of file test.c.

1483{
1484#ifdef TEST_FRAMEWORK
1485 ast_register_cleanup(test_cleanup);
1486
1487 /* Create stasis topic */
1488 test_suite_topic = stasis_topic_create("testsuite:all");
1489 if (!test_suite_topic) {
1490 return -1;
1491 }
1492
1493 if (STASIS_MESSAGE_TYPE_INIT(ast_test_suite_message_type) != 0) {
1494 return -1;
1495 }
1496
1497 AST_TEST_REGISTER(test_registrations);
1498
1499 /* Register cli commands */
1500 ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli));
1501#endif
1502
1503 return 0;
1504}
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:617
#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().