Beginnings of test_embed_record
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 4 Jun 2012 13:01:06 +0000 (15:01 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 4 Jun 2012 13:01:06 +0000 (15:01 +0200)
test/.gitignore
test/Makefile.am
test/test_embed_record.c [new file with mode: 0644]

index 97fdae2..43f14b5 100644 (file)
@@ -6,6 +6,7 @@ test_odrcodec.h
 .libs
 test_cql2ccl
 test_ccl
+test_embed_record
 test_iconv
 test_matchstr
 test_nmem
index 32a14ba..2339409 100644 (file)
@@ -2,7 +2,7 @@
 ## Copyright (C) 1995-2012 Index Data
 
 check_PROGRAMS = test_ccl test_comstack test_cql2ccl \
- test_filepath test_file_glob \
+ test_embed_record test_filepath test_file_glob \
  test_iconv test_icu test_json \
  test_libstemmer test_log test_log_thread \
  test_match_glob test_matchstr test_mutex \
@@ -97,3 +97,4 @@ test_xml_include_SOURCES = test_xml_include.c
 test_file_glob_SOURCES = test_file_glob.c
 test_shared_ptr_SOURCES = test_shared_ptr.c
 test_libstemmer_SOURCES = test_libstemmer.c
+test_embed_record_SOURCES = test_embed_record.c
diff --git a/test/test_embed_record.c b/test/test_embed_record.c
new file mode 100644 (file)
index 0000000..52d591f
--- /dev/null
@@ -0,0 +1,50 @@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2012 Index Data
+ * See the file LICENSE for details.
+ */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <yaz/record_conv.h>
+#include <yaz/test.h>
+#include <yaz/wrbuf.h>
+#include <string.h>
+#include <yaz/log.h>
+
+#if YAZ_HAVE_XML2
+
+#include <yaz/base64.h>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+void test(void)
+{
+    char sample_rec[] = "MTIzNAo=";
+    char out_rec[10];
+    yaz_base64decode(sample_rec, out_rec);
+    YAZ_CHECK(strcmp(out_rec, "1234\n") == 0);
+}
+#endif
+
+int main(int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+    YAZ_CHECK_LOG();
+#if YAZ_HAVE_XML2
+    test();
+#endif
+    YAZ_CHECK_TERM;
+}
+
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+