X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fcodec%2Ftstcodec.c;h=449ce8aa45a1016a9af0db5f288bdbaf1562b4b1;hb=5403eea61e14f91b1863c151cfa0f60561ca95ec;hp=3e46866c6e32d70e2f6d877938d44513f1bf0098;hpb=c8f76d22ffc89ae0a867b6b6e91bbb279bde1f9e;p=idzebra-moved-to-github.git diff --git a/test/codec/tstcodec.c b/test/codec/tstcodec.c index 3e46866..449ce8a 100644 --- a/test/codec/tstcodec.c +++ b/test/codec/tstcodec.c @@ -1,8 +1,5 @@ -/* $Id: tstcodec.c,v 1.7 2005-08-05 10:33:05 adam Exp $ - Copyright (C) 1995-2005 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -15,11 +12,14 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#if HAVE_CONFIG_H +#include +#endif #include #include "../../index/index.h" @@ -64,7 +64,7 @@ int tst_encode(int num) char *dst = (char *) &key; const char *src0 = src; iscz1_decode(codec_handle, &dst, &src); - + if (key.len != 2) { printf ("%s: i=%d key.len=%d expected 2\n", prog, @@ -109,7 +109,7 @@ int tst_encode(int num) return 0; } -void tstcodec1() +void tstcodec1(void) { char buf[100]; char *dst = buf; @@ -137,7 +137,7 @@ void tstcodec1() dst = (char*) &key2; src = buf; - + iscz1_decode(codec_handle, &dst, &src); iscz1_stop(codec_handle); @@ -151,17 +151,85 @@ void tstcodec1() printf ("offset=%d char1=%d char2=%d\n", i, cp1[i], cp2[i]); } } - + +int tstcodec2(int num) +{ + int errors = 0; + int i; + int max = 2048; + int neg = 0; /* iscz1_{en,de}code does not handle negative numbers */ + void *encode_handle =iscz1_start(); + void *decode_handle =iscz1_start(); + + srand(12); + for (i = 0; i 1) num = atoi(argv[1]); if (num < 1 || num > 100000000) num = 10000; tstcodec1(); - exit(tst_encode(num)); + ret = tstcodec2(500); + ret = tst_encode(num); + exit(ret); } - + +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +