testlib.h 994 B

1234567891011121314151617181920212223242526272829
  1. /* testlib.h --- reporting test results
  2. Jim Blandy <jimb@red-bean.com> --- August 1999 */
  3. #ifndef TESTLIB_H
  4. #define TESTLIB_H
  5. extern void test_pass (char *name);
  6. extern void test_fail (char *name);
  7. extern void test_pass_if (char *name, int condition);
  8. /* We need a way to keep track of what groups of tests we're currently
  9. within. A call to test_enter_context assures that future tests
  10. will be reported with a name prefixed by NAME, until we call
  11. test_restore_context with the value it returned.
  12. Calls to test_enter_context and test_restore_context should be
  13. properly nested; passing the context around allows them to detect
  14. mismatches.
  15. It is the caller's responsibility to free NAME after exiting the
  16. context. (This is trivial if you're passing string literals to
  17. test_enter_context.) */
  18. typedef int test_context_t;
  19. extern test_context_t test_enter_context (char *name);
  20. extern void test_restore_context (test_context_t context);
  21. #endif /* TESTLIB_H */