Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
Benny Prijono | 844653c | 2008-12-23 17:27:53 +0000 | [diff] [blame] | 3 | * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) |
Benny Prijono | 32177c0 | 2008-06-20 22:44:47 +0000 | [diff] [blame] | 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 5 | * |
| 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 | |
| 34 | pj_pool_factory *mem; |
| 35 | |
| 36 | |
| 37 | void app_perror(pj_status_t status, const char *msg) |
| 38 | { |
Benny Prijono | cf5c06d | 2008-03-26 16:18:17 +0000 | [diff] [blame] | 39 | char errbuf[PJ_ERR_MSG_SIZE]; |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 40 | |
| 41 | pjmedia_strerror(status, errbuf, sizeof(errbuf)); |
| 42 | |
| 43 | PJ_LOG(3,(THIS_FILE, "%s: %s", msg, errbuf)); |
| 44 | } |
| 45 | |
| 46 | int test_main(void) |
| 47 | { |
Benny Prijono | cf5c06d | 2008-03-26 16:18:17 +0000 | [diff] [blame] | 48 | int rc = 0; |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 49 | 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 Prijono | 0ff56dc | 2008-07-04 16:45:17 +0000 | [diff] [blame] | 55 | pj_log_set_level(3); |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 56 | |
| 57 | mem = &caching_pool.factory; |
| 58 | |
Benny Prijono | 1dc0da7 | 2009-04-18 00:12:13 +0000 | [diff] [blame] | 59 | DO_TEST(sdp_neg_test()); |
| 60 | //DO_TEST(sdp_test (&caching_pool.factory)); |
| 61 | //DO_TEST(rtp_test(&caching_pool.factory)); |
| 62 | //DO_TEST(session_test (&caching_pool.factory)); |
Nanang Izzuddin | ad4bb0a | 2009-04-06 17:13:33 +0000 | [diff] [blame] | 63 | DO_TEST(jbuf_main()); |
Benny Prijono | 1dc0da7 | 2009-04-18 00:12:13 +0000 | [diff] [blame] | 64 | DO_TEST(mips_test()); |
| 65 | DO_TEST(codec_test_vectors()); |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 66 | |
| 67 | PJ_LOG(3,(THIS_FILE," ")); |
| 68 | |
Nanang Izzuddin | ad4bb0a | 2009-04-06 17:13:33 +0000 | [diff] [blame] | 69 | on_return: |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 70 | if (rc != 0) { |
| 71 | PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!")); |
| 72 | } else { |
| 73 | PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!")); |
| 74 | } |
| 75 | |
| 76 | pj_caching_pool_destroy(&caching_pool); |
Nanang Izzuddin | ad4bb0a | 2009-04-06 17:13:33 +0000 | [diff] [blame] | 77 | |
Benny Prijono | 4ea0bf1 | 2006-02-02 19:16:07 +0000 | [diff] [blame] | 78 | return rc; |
| 79 | } |