Simplify and clean X509_VERIFY_PARAM new/free code.
[openssl.git] / test / testutil.h
index 68d202adb15d6a6161be0fbd00b54b2b9496c67e..53d58bee5ca25f210acf3924fab53da9959b3567 100644 (file)
 
 #include <openssl/err.h>
 
+/*
+ * In main(), call ADD_TEST to register each test case function, then call
+ * run_tests() to execute all tests and report the results. The result
+ * returned from run_tests() should be used as the return value for main().
+ */
+# define ADD_TEST(test_function) add_test(#test_function, test_function)
+
 /*-
+ * Test cases that share common setup should use the helper
  * SETUP_TEST_FIXTURE and EXECUTE_TEST macros for test case functions.
  *
  * SETUP_TEST_FIXTURE will call set_up() to create a new TEST_FIXTURE_TYPE
         tear_down(fixture);\
         return result
 
+/* Shorthand if tear_down does nothing. */
+# define EXECUTE_TEST_NO_TEARDOWN(execute_func)\
+        result = execute_func(fixture);\
+        return result
+
 /*
  * TEST_CASE_NAME is defined as the name of the test case function where
  * possible; otherwise we get by with the file name and line number.
 #  define TEST_CASE_NAME __func__
 # endif                         /* __STDC_VERSION__ */
 
-/*
- * In main(), call ADD_TEST to register each test case function, then call
- * run_tests() to execute all tests and report the results. The result
- * returned from run_tests() should be used as the return value for main().
- */
-# define ADD_TEST(test_function) add_test(#test_function, test_function)
-
 /*
  * Simple parameterized tests. Adds a test_function(idx) test for each
  * 0 <= idx < num.