+#include <openssl/err.h>
+#include <openssl/e_os2.h>
+
+/*-
+ * Simple unit tests should implement register_tests() from test_main.h
+ * and link against test_main.c.
+ * To register tests, call ADD_TEST or ADD_ALL_TESTS:
+ *
+ * #include "test_main.h"
+ *
+ * void register_tests(void)
+ * {
+ * ADD_TEST(test_foo);
+ * ADD_ALL_TESTS(test_bar, num_test_bar);
+ * }
+ *
+ * Tests that need to perform custom setup or read command-line arguments should
+ * implement test_main() from test_main_custom.h and link against
+ * test_main_custom.c:
+ *
+ * int test_main(int argc, char *argv[])
+ * {
+ * int ret;
+ *
+ * // Custom setup ...
+ *
+ * ADD_TEST(test_foo);
+ * ADD_ALL_TESTS(test_bar, num_test_bar);
+ * // Add more tests ...
+ *
+ * ret = run_tests(argv[0]);
+ *
+ * // Custom teardown ...
+ *
+ * return ret;
+ * }
+ */
+
+/* Adds a simple test case. */
+# define ADD_TEST(test_function) add_test(#test_function, test_function)
+
+/*
+ * Simple parameterized tests. Calls test_function(idx) for each 0 <= idx < num.
+ */
+# define ADD_ALL_TESTS(test_function, num) \
+ add_all_tests(#test_function, test_function, num)
+