3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
#include <pjlib-util.h>
24
void app_perror(const char *msg, pj_status_t rc)
30
pj_strerror(rc, errbuf, sizeof(errbuf));
31
PJ_LOG(1,("test", "%s: [pj_status_t=%d] %s", msg, rc, errbuf));
34
#define DO_TEST(test) do { \
35
PJ_LOG(3, ("test", "Running %s...", #test)); \
39
(char*)(rc ? "..ERROR" : "..success"), rc)); \
40
if (rc!=0) goto on_return; \
46
int param_log_decor = PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME |
49
static int test_inner(void)
51
pj_caching_pool caching_pool;
54
mem = &caching_pool.factory;
57
pj_log_set_decor(param_log_decor);
61
app_perror("pj_init() error!!", rc);
65
rc = pjlib_util_init();
69
pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 0 );
75
#if INCLUDE_ENCRYPTION_TEST
76
DO_TEST(encryption_test());
77
DO_TEST(encryption_benchmark());
84
#if INCLUDE_RESOLVER_TEST
85
DO_TEST(resolver_test());
88
#if INCLUDE_HTTP_CLIENT_TEST
89
DO_TEST(http_client_test());
104
int id = PJ_GET_EXCEPTION();
105
PJ_LOG(3,("test", "FATAL: unhandled exception id %d (%s)",
106
id, pj_exception_id_name(id)));