Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame^] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | #include "test.h" |
| 20 | |
| 21 | #define THIS_FILE "test.c" |
| 22 | |
| 23 | #define DO_TEST(test) do { \ |
| 24 | PJ_LOG(3, (THIS_FILE, "Running %s...", #test)); \ |
| 25 | rc = test; \ |
| 26 | PJ_LOG(3, (THIS_FILE, \ |
| 27 | "%s(%d)", \ |
| 28 | (rc ? "..ERROR" : "..success"), rc)); \ |
| 29 | if (rc!=0) goto on_return; \ |
| 30 | } while (0) |
| 31 | |
| 32 | |
| 33 | pj_pool_factory *mem; |
| 34 | |
| 35 | |
| 36 | void app_perror(pj_status_t status, const char *msg) |
| 37 | { |
| 38 | char errbuf[PJMEDIA_ERR_MSG_SIZE]; |
| 39 | |
| 40 | pjmedia_strerror(status, errbuf, sizeof(errbuf)); |
| 41 | |
| 42 | PJ_LOG(3,(THIS_FILE, "%s: %s", msg, errbuf)); |
| 43 | } |
| 44 | |
| 45 | int test_main(void) |
| 46 | { |
| 47 | int rc; |
| 48 | pj_caching_pool caching_pool; |
| 49 | |
| 50 | pj_init(); |
| 51 | pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0); |
| 52 | |
| 53 | pj_log_set_decor(PJ_LOG_HAS_NEWLINE); |
| 54 | |
| 55 | mem = &caching_pool.factory; |
| 56 | |
| 57 | DO_TEST(sdp_neg_test()); |
| 58 | //sdp_test (&caching_pool.factory); |
| 59 | //rtp_test(&caching_pool.factory); |
| 60 | //session_test (&caching_pool.factory); |
| 61 | //jbuf_main(&caching_pool.factory); |
| 62 | |
| 63 | PJ_LOG(3,(THIS_FILE," ")); |
| 64 | |
| 65 | on_return: |
| 66 | |
| 67 | if (rc != 0) { |
| 68 | PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!")); |
| 69 | } else { |
| 70 | PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!")); |
| 71 | } |
| 72 | |
| 73 | pj_caching_pool_destroy(&caching_pool); |
| 74 | return rc; |
| 75 | } |