Asterisk - The Open Source Telephony Project  21.4.1
Functions
test.c File Reference

Unit Test Framework. More...

#include "asterisk.h"
#include "asterisk/_private.h"

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

int ast_test_init ( void  )

Provided by test.c

Definition at line 1482 of file test.c.

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

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 }
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Definition: stasis.h:1493
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
Definition: stasis.c:617