Add wrbuf_sha1_write
[yaz-moved-to-github.git] / test / test_wrbuf.c
index 7c27fe5..e7886c4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
  * See the file LICENSE for details.
  */
 #if HAVE_CONFIG_H
@@ -76,6 +76,15 @@ static void tstwrbuf(void)
     wrbuf_insert(wr, 5, "abc", 3);
     YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234"));
 
+#if HAVE_GCRYPT_H
+    {
+        const char *msg = "Hello world\n";
+        wrbuf_rewind(wr);
+        wrbuf_sha1_write(wr, msg, strlen(msg), 1);
+        YAZ_CHECK(!strcmp(wrbuf_cstr(wr), 
+                          "33ab5639bfd8e7b95eb1d8d0b87781d4ffea4d5d"));
+    }
+#endif
     wrbuf_destroy(wr);
 }