X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ft4.c;h=b38a9a5fa9df44b132e1b3ef7854ff9b601a19e5;hb=e172ced0dcc937dfc433a33c7e20962b9e6b5ea0;hp=9fb81b728917415add13a06a9b130b8da2b69561;hpb=4a3a97df9d47b8d099e403308f8015f130366994;p=idzebra-moved-to-github.git diff --git a/test/api/t4.c b/test/api/t4.c index 9fb81b7..b38a9a5 100644 --- a/test/api/t4.c +++ b/test/api/t4.c @@ -1,4 +1,4 @@ -/* $Id: t4.c,v 1.8 2004-07-28 08:15:47 adam Exp $ +/* $Id: t4.c,v 1.11 2004-10-29 13:02:39 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -20,46 +20,32 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include +/* t4 - insert a small pile of records, search and fetch them */ -/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */ -static ZebraService start_service() -{ - char cfg[256]; - char *srcdir = getenv("srcdir"); - sprintf(cfg, "%.200s%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); - return zebra_start(cfg); -} +#include "testlib.h" + +const char *myrec[] = { + "\n" + " My title\n" + "\n", + 0}; int main(int argc, char **argv) { int i; - ZebraService zs; - ZebraHandle zh; - const char *myrec = - "\n" - " My title\n" - "\n"; + ZebraService zs = start_up(0, argc, argv);; + ZebraHandle zh = zebra_open (zs); - yaz_log_init_file("t4.log"); - - nmem_init (); - - zs = start_service(); - zh = zebra_open (zs); - zebra_init(zh); - zebra_select_database(zh, "Default"); + init_data(zh,myrec); zebra_begin_trans (zh, 1); for (i = 0; i<1200; i++) - zebra_add_record (zh, myrec, strlen(myrec)); + zebra_add_record (zh, myrec[0], strlen(myrec[0])); zebra_end_trans (zh); zebra_close(zh); zebra_stop(zs); - zs = start_service(); + zs = start_service(""); zh = zebra_open (zs); zebra_select_database(zh, "Default"); @@ -97,10 +83,5 @@ int main(int argc, char **argv) } zebra_commit (zh); - zebra_close (zh); - zebra_stop (zs); - - nmem_exit (); - xmalloc_trav ("x"); - exit (0); + return close_down(zh,zs,0); }