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
void test_info(const char *file, int line, const char *desc, ...)
PRINTF_FORMAT(3, 4);
void test_info_c90(const char *desc, ...) PRINTF_FORMAT(1, 2);
+void test_note(const char *desc, ...) PRINTF_FORMAT(1, 2);
void test_openssl_errors(void);
/*
# 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)
# define TEST_error(...) test_error(__FILE__, __LINE__, __VA_ARGS__)
# define TEST_info(...) test_info(__FILE__, __LINE__, __VA_ARGS__)
# endif
+# define TEST_note test_note
# define TEST_openssl_errors test_openssl_errors
/*
extern BIO *bio_out;
extern BIO *bio_err;
+/*
+ * Formatted output for strings, memory and bignums.
+ */
+void test_output_string(const char *name, const char *m, size_t l);
+void test_output_bignum(const char *name, const BIGNUM *bn);
+void test_output_memory(const char *name, const unsigned char *m, size_t l);
+
+
+/*
+ * 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 */