Infrastructure: Strip away crufty CVS $Id$ tags.
[mLib] / testrig.h
index 8588287..3729794 100644 (file)
--- a/testrig.h
+++ b/testrig.h
@@ -1,7 +1,5 @@
 /* -*-c-*-
  *
- * $Id: testrig.h,v 1.7 2004/04/08 01:36:13 mdw Exp $
- *
  * Generic test driver
  *
  * (c) 1998 Straylight/Edgeware
 
 /*----- Data structures ---------------------------------------------------*/
 
+typedef struct test_results {
+  unsigned tests, failed;
+} test_results;
+
 /* --- Test field definition --- */
 
 typedef struct test_type {
@@ -62,6 +64,11 @@ typedef struct test_chunk {
   const test_type *f[TEST_FIELDMAX];   /* Field definitions */
 } test_chunk;
 
+typedef struct test_suite {
+  const char *name;                    /* Name of this suite */
+  const test_chunk *chunks;            /* Chunks contained in this suite */
+} test_suite;
+
 /*----- Predefined data types ---------------------------------------------*/
 
 extern const test_type type_hex;
@@ -73,6 +80,23 @@ extern const test_type type_uint32;
 
 /*----- Functions provided ------------------------------------------------*/
 
+/* --- @test_do@ --- *
+ *
+ * Arguments:  @const test_suite suites[]@ = pointer to suite definitions
+ *             @FILE *fp@ = test vector file, ready opened
+ *             @test_results *results@ = where to put results
+ *
+ * Returns:    Negative if something bad happened, or the number of
+ *             failures.
+ *
+ * Use:                Runs a collection of tests against a file of test vectors and
+ *             reports the results.
+ */
+
+extern int test_do(const test_suite /*suite*/[],
+                  FILE */*fp*/,
+                  test_results */*results*/);
+
 /* --- @test_run@ --- *
  *
  * Arguments:  @int argc@ = number of command line arguments