@@@ tvec doc wip
[mLib] / struct / t / dstr-putf-test.c
index 13fe155..eb67e60 100644 (file)
@@ -1,3 +1,32 @@
+/* -*-c-*-
+ *
+ * Test driver for universal hashing
+ *
+ * (c) 2009 Straylight/Edgeware
+ */
+
+/*----- Licensing notice --------------------------------------------------*
+ *
+ * This file is part of the mLib utilities library.
+ *
+ * mLib is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * mLib is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with mLib; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+/*----- Header files ------------------------------------------------------*/
+
 #include "config.h"
 
 #include <assert.h>
 #include "report.h"
 #include "tvec.h"
 
+/*----- Static variables --------------------------------------------------*/
+
 static struct tvec_state tvstate;
 static dstr d = DSTR_INIT;
 static char strbuf[1024];
 
+/*----- Utilities ---------------------------------------------------------*/
+
 #define TESTGROUP(name) TVEC_TESTGROUP_TAG(grp, &tvstate, name)
 
 static PRINTF_LIKE(1, 2) int format(const char *fmt, ...)
@@ -48,8 +81,8 @@ static PRINTF_LIKE(1, 2) void prepare(const char *fmt, ...)
   int n; n = format fmtargs;                                           \
   tvec_claimeq_int(&tvstate, n, strlen(want),                          \
                   __FILE__, __LINE__, "format " #fmtargs);             \
-  tvec_claimeq_string(&tvstate, d.buf, d.len, want, strlen(want),      \
-                     __FILE__, __LINE__, "format " #fmtargs);          \
+  tvec_claimeq_text(&tvstate, d.buf, d.len, want, strlen(want),        \
+                   __FILE__, __LINE__, "format " #fmtargs);    \
 } while (0)
 
 #define TEST_REF(fmtargs) do {                                         \
@@ -57,13 +90,15 @@ static PRINTF_LIKE(1, 2) void prepare(const char *fmt, ...)
   prepare fmtargs;                                                     \
   tvec_claimeq_int(&tvstate, n, strlen(strbuf),                                \
                   __FILE__, __LINE__, "format " #fmtargs);             \
-  tvec_claimeq_string(&tvstate, d.buf, d.len, strbuf, strlen(strbuf),  \
-                     __FILE__, __LINE__, "format " #fmtargs);          \
+  tvec_claimeq_text(&tvstate, d.buf, d.len, strbuf, strlen(strbuf),    \
+                   __FILE__, __LINE__, "format " #fmtargs);            \
 } while (0)
 
-#define LENGTHY \
+#define LENGTHY                                                                \
   "This is a rather longer string than the code is expecting: will it fit?"
 
+/*----- Main program ------------------------------------------------------*/
+
 int main(int argc, char *argv[])
 {
   struct tvec_test test;
@@ -115,3 +150,5 @@ int main(int argc, char *argv[])
 
   return (tvec_end(&tvstate));
 }
+
+/*----- That's all, folks -------------------------------------------------*/