void add_all_tests(const char *test_case_name, int (*test_fn)(int idx), int num,
int subtest);
__owur int run_tests(const char *test_prog_name);
+void set_test_title(const char *title);
/*
* Declarations for user defined functions
# define TEST_BN_eq(a, b) test_BN_eq(__FILE__, __LINE__, #a, #b, a, b)
# define TEST_BN_ne(a, b) test_BN_ne(__FILE__, __LINE__, #a, #b, a, b)
+# define TEST_BN_lt(a, b) test_BN_lt(__FILE__, __LINE__, #a, #b, a, b)
+# define TEST_BN_gt(a, b) test_BN_gt(__FILE__, __LINE__, #a, #b, a, b)
+# define TEST_BN_le(a, b) test_BN_le(__FILE__, __LINE__, #a, #b, a, b)
+# define TEST_BN_ge(a, b) test_BN_ge(__FILE__, __LINE__, #a, #b, a, b)
# define TEST_BN_eq_zero(a) test_BN_eq_zero(__FILE__, __LINE__, #a, a)
# define TEST_BN_ne_zero(a) test_BN_ne_zero(__FILE__, __LINE__, #a, a)
# define TEST_BN_lt_zero(a) test_BN_lt_zero(__FILE__, __LINE__, #a, a)
extern BIO *bio_out;
extern BIO *bio_err;
+/*
+ * Utilities to parse a test file.
+ */
+#define TESTMAXPAIRS 20
+
+typedef struct pair_st {
+ char *key;
+ char *value;
+} PAIR;
+
+typedef struct stanza_st {
+ const char *test_file; /* Input file name */
+ BIO *fp; /* Input file */
+ int curr; /* Current line in file */
+ int start; /* Line where test starts */
+ int errors; /* Error count */
+ int numtests; /* Number of tests */
+ int numskip; /* Number of skipped tests */
+ int numpairs;
+ PAIR pairs[TESTMAXPAIRS];
+ BIO *key; /* temp memory BIO for reading in keys */
+ char buff[4096]; /* Input buffer for a single key/value */
+} STANZA;
+
+/*
+ * Prepare to start reading the file |testfile| as input.
+ */
+int test_start_file(STANZA *s, const char *testfile);
+int test_end_file(STANZA *s);
+
+/*
+ * Read a stanza from the test file. A stanza consists of a block
+ * of lines of the form
+ * key = value
+ * The block is terminated by EOF or a blank line.
+ * Return 1 if found, 0 on EOF or error.
+ */
+int test_readstanza(STANZA *s);
+
+/*
+ * Clear a stanza, release all allocated memory.
+ */
+void test_clearstanza(STANZA *s);
+
#endif /* HEADER_TESTUTIL_H */