Asterisk - The Open Source Telephony Project  GIT-master-b7027de
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

◆ ast_test_init()

int ast_test_init ( void  )

Provided by test.c

Definition at line 1221 of file test.c.

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().

1222 {
1223 #ifdef TEST_FRAMEWORK
1224  ast_register_cleanup(test_cleanup);
1225 
1226  /* Create stasis topic */
1227  test_suite_topic = stasis_topic_create("testsuite:all");
1228  if (!test_suite_topic) {
1229  return -1;
1230  }
1231 
1232  if (STASIS_MESSAGE_TYPE_INIT(ast_test_suite_message_type) != 0) {
1233  return -1;
1234  }
1235 
1236  AST_TEST_REGISTER(test_registrations);
1237 
1238  /* Register cli commands */
1239  ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli));
1240 #endif
1241 
1242  return 0;
1243 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Definition: stasis.h:1501
#define AST_TEST_REGISTER(cb)
Definition: test.h:127
#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:618