From a08b589d09d5197f9a76d549a189e4686bd2ca8c Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 13 Nov 2005 19:40:44 +0000 Subject: Applying license to pjproject git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@49 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pjlib-test/fifobuf.c | 221 ++++++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 100 deletions(-) (limited to 'pjlib/src/pjlib-test/fifobuf.c') diff --git a/pjlib/src/pjlib-test/fifobuf.c b/pjlib/src/pjlib-test/fifobuf.c index 2f59473d..55d4c5aa 100644 --- a/pjlib/src/pjlib-test/fifobuf.c +++ b/pjlib/src/pjlib-test/fifobuf.c @@ -1,100 +1,121 @@ -/* $Id$ - */ -#include "test.h" - -/* To prevent warning about "translation unit is empty" - * when this test is disabled. - */ -int dummy_fifobuf_test; - -#if INCLUDE_FIFOBUF_TEST - -#include - -int fifobuf_test() -{ - enum { SIZE = 1024, MAX_ENTRIES = 128, - MIN_SIZE = 4, MAX_SIZE = 64, - LOOP=10000 }; - pj_pool_t *pool; - pj_fifobuf_t fifo; - unsigned available = SIZE; - void *entries[MAX_ENTRIES]; - void *buffer; - int i; - - pool = pj_pool_create(mem, NULL, SIZE+256, 0, NULL); - if (!pool) - return -10; - - buffer = pj_pool_alloc(pool, SIZE); - if (!buffer) - return -20; - - pj_fifobuf_init (&fifo, buffer, SIZE); - - // Test 1 - for (i=0; i=MIN_SIZE+4 && count < MAX_ENTRIES;) { - int size = MIN_SIZE+(pj_rand() % MAX_SIZE); - entries[count] = pj_fifobuf_alloc (&fifo, size); - if (entries[count]) { - available -= (size+4); - ++count; - } - } - for (j=0; j + * + * Author: + * Benny Prijono + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "test.h" + +/* To prevent warning about "translation unit is empty" + * when this test is disabled. + */ +int dummy_fifobuf_test; + +#if INCLUDE_FIFOBUF_TEST + +#include + +int fifobuf_test() +{ + enum { SIZE = 1024, MAX_ENTRIES = 128, + MIN_SIZE = 4, MAX_SIZE = 64, + LOOP=10000 }; + pj_pool_t *pool; + pj_fifobuf_t fifo; + unsigned available = SIZE; + void *entries[MAX_ENTRIES]; + void *buffer; + int i; + + pool = pj_pool_create(mem, NULL, SIZE+256, 0, NULL); + if (!pool) + return -10; + + buffer = pj_pool_alloc(pool, SIZE); + if (!buffer) + return -20; + + pj_fifobuf_init (&fifo, buffer, SIZE); + + // Test 1 + for (i=0; i=MIN_SIZE+4 && count < MAX_ENTRIES;) { + int size = MIN_SIZE+(pj_rand() % MAX_SIZE); + entries[count] = pj_fifobuf_alloc (&fifo, size); + if (entries[count]) { + available -= (size+4); + ++count; + } + } + for (j=0; j