Added small test of codec speed
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 9 Jun 2004 12:13:03 +0000 (12:13 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 9 Jun 2004 12:13:03 +0000 (12:13 +0000)
test/Makefile.am
test/codec/Makefile.am [new file with mode: 0644]
test/codec/tstcodec.c [new file with mode: 0644]

index 670f307..f61aaba 100644 (file)
@@ -1,4 +1,4 @@
 
-SUBDIRS=api gils malxml config usmarc dmoz xpath sort xelm cddb \
+SUBDIRS=codec api gils malxml config usmarc dmoz xpath sort xelm cddb \
  rusmarc zsh marcxml charmap
 
diff --git a/test/codec/Makefile.am b/test/codec/Makefile.am
new file mode 100644 (file)
index 0000000..2c5d3f0
--- /dev/null
@@ -0,0 +1,11 @@
+# $Id: Makefile.am,v 1.1 2004-06-09 12:13:03 adam Exp $
+
+TESTS = tstcodec
+
+tstcodec_SOURCES = tstcodec.c
+
+noinst_PROGRAMS = tstcodec
+
+AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC)
+
+LDADD = ../../index/libzebra.a $(YAZLIB) $(TCL_LIB)
diff --git a/test/codec/tstcodec.c b/test/codec/tstcodec.c
new file mode 100644 (file)
index 0000000..029cb50
--- /dev/null
@@ -0,0 +1,28 @@
+#include "../index/index.h"
+
+
+void tst_encode(int num)
+{
+    struct it_key key;
+    int i;
+    void *codec_handle =iscz1_code_start(ISAMC_ENCODE);
+
+    for (i = 0; i<num; i++)
+    {
+       char dst_buf[200];
+       char *dst = dst_buf;
+       char *src = (char*)  &key;
+
+       key.sysno = num;
+       key.seqno = 1;  
+       iscz1_code_item (ISAMC_ENCODE, codec_handle, &dst, &src);
+    }
+    iscz1_code_stop(ISAMC_ENCODE, codec_handle);
+}
+
+int main(int argc, char **argv)
+{
+    tst_encode(1000000);
+    exit(0);
+}
+