blob: 385eee15e1fd5af455c56640168477cfe288e536 [file] [log] [blame]
Benny Prijono4ea0bf12006-02-02 19:16:07 +00001/* $Id$ */
2/*
Benny Prijono844653c2008-12-23 17:27:53 +00003 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
Benny Prijono32177c02008-06-20 22:44:47 +00004 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono4ea0bf12006-02-02 19:16:07 +00005 *
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.
10 *
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.
15 *
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
19 */
20#include "test.h"
21
22#define THIS_FILE "test.c"
23
24#define DO_TEST(test) do { \
25 PJ_LOG(3, (THIS_FILE, "Running %s...", #test)); \
26 rc = test; \
27 PJ_LOG(3, (THIS_FILE, \
28 "%s(%d)", \
29 (rc ? "..ERROR" : "..success"), rc)); \
30 if (rc!=0) goto on_return; \
31 } while (0)
32
33
34pj_pool_factory *mem;
35
36
37void app_perror(pj_status_t status, const char *msg)
38{
Benny Prijonocf5c06d2008-03-26 16:18:17 +000039 char errbuf[PJ_ERR_MSG_SIZE];
Benny Prijono4ea0bf12006-02-02 19:16:07 +000040
41 pjmedia_strerror(status, errbuf, sizeof(errbuf));
42
43 PJ_LOG(3,(THIS_FILE, "%s: %s", msg, errbuf));
44}
45
46int test_main(void)
47{
Benny Prijonocf5c06d2008-03-26 16:18:17 +000048 int rc = 0;
Benny Prijono4ea0bf12006-02-02 19:16:07 +000049 pj_caching_pool caching_pool;
50
51 pj_init();
52 pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
53
54 pj_log_set_decor(PJ_LOG_HAS_NEWLINE);
Benny Prijono0ff56dc2008-07-04 16:45:17 +000055 pj_log_set_level(3);
Benny Prijono4ea0bf12006-02-02 19:16:07 +000056
57 mem = &caching_pool.factory;
58
Benny Prijono41a14512009-08-15 10:05:36 +000059#if HAS_SDP_NEG_TEST
Benny Prijono1dc0da72009-04-18 00:12:13 +000060 DO_TEST(sdp_neg_test());
Benny Prijono41a14512009-08-15 10:05:36 +000061#endif
Benny Prijono1dc0da72009-04-18 00:12:13 +000062 //DO_TEST(sdp_test (&caching_pool.factory));
63 //DO_TEST(rtp_test(&caching_pool.factory));
64 //DO_TEST(session_test (&caching_pool.factory));
Benny Prijono41a14512009-08-15 10:05:36 +000065#if HAS_JBUF_TEST
Nanang Izzuddinad4bb0a2009-04-06 17:13:33 +000066 DO_TEST(jbuf_main());
Benny Prijono41a14512009-08-15 10:05:36 +000067#endif
68#if HAS_MIPS_TEST
Benny Prijono1dc0da72009-04-18 00:12:13 +000069 DO_TEST(mips_test());
Benny Prijono41a14512009-08-15 10:05:36 +000070#endif
71#if HAS_CODEC_VECTOR_TEST
Benny Prijono1dc0da72009-04-18 00:12:13 +000072 DO_TEST(codec_test_vectors());
Benny Prijono41a14512009-08-15 10:05:36 +000073#endif
Benny Prijono4ea0bf12006-02-02 19:16:07 +000074
75 PJ_LOG(3,(THIS_FILE," "));
76
Nanang Izzuddinad4bb0a2009-04-06 17:13:33 +000077on_return:
Benny Prijono4ea0bf12006-02-02 19:16:07 +000078 if (rc != 0) {
79 PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!"));
80 } else {
81 PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!"));
82 }
83
84 pj_caching_pool_destroy(&caching_pool);
Nanang Izzuddinad4bb0a2009-04-06 17:13:33 +000085
Benny Prijono4ea0bf12006-02-02 19:16:07 +000086 return rc;
87}